Truncated shell.json falls back to builtin defaults; the next config write persists them (bar resets, third-party plugins disabled)
What happens
When ~/.config/omarchy/shell.json becomes empty (0 bytes) while the shell is running, the bar reverts to the stock layout and every third-party plugin is disabled — permanently, because the very next shell-side config write persists the shipped defaults over the user's file. No backup is written and nothing is logged.
This is the same mutateShellConfig fallback as #11349, but with a different trigger: #11349 is the startup window (a mutation landing before the async FileView load completes). This one is a runtime truncation — the user's file is already loaded and fine, then it becomes empty, and the shell turns that into a permanent reset.
Why
The truncation reaches the fallback through the FileView change/reload path:
// shell.qml
FileView {
id: userConfigFile
path: shell.userConfigPath
watchChanges: true
atomicWrites: true
onLoaded: shell.applyShellConfig()
onLoadFailed: function(error) { shell.applyShellConfig() }
onFileChanged: reload() // line 142
}
When the file changes (including becoming 0 bytes), reload() → onLoaded → applyShellConfig():
// shell.qml:73-88
function applyShellConfig() {
var defaults = Util.isPlainObject(defaultsConfig) ? defaultsConfig : builtinShellConfig
var user = null
var userText = userConfigFile.text() || ""
if (userText.trim()) {
// parse; set user
}
shellConfig = user || defaults // empty file → user null → builtinShellConfig (stock)
}
shellConfig is now the builtin stock config. The next plugin-initiated write — idle service, a widget persisting a setting, OmaSettings, omarchy bar set … — goes through mutateShellConfig():
// shell.qml:162-166 (also 1069 in updateEntryInline)
function mutateShellConfig(mutator) {
var copy = JSON.parse(JSON.stringify(shellConfig || builtinShellConfig))
mutator(copy)
persistShellConfig(copy) // writes the whole file — stock layout + plugins: []
}
…which writes the stock config back to disk. A transient truncation is now a permanent reset, and because enablement is stored in shell.json, every third-party plugin drops off the bar at once.
Evidence
On an edge-channel install I've seen this ~14 times across a week. A path-unit guard I run snapshots and restores the file, so the timeline is recorded:
-
14 ×
shell.json.bak.EMPTY.*artifacts — the 0-byte truncations (Sep 16–19). -
Guard log: after each truncation the file came back within ~2 s as a ~1370-byte config — the shipped default, not the user's (2312–2351-byte) config:
2026-09-21 21:04:50 was mid-write (1372 bytes) — snapshot updated 2026-09-22 20:37:01 was mid-write (1374 bytes) — snapshot updated -
After restoring the user's config on Sep 21 22:55, the file was rewritten to stock again at 22:57 (
shell.json.bak.RESET.20260921225710, 1374 bytes) — a settings change landing after a truncation, persisting the defaults.
The spontaneous 0-byte truncation itself is a separate, still-unexplained bug (every occurrence lands within the minute of a shell config reload, often right after an omarchy update; the shell's own FileView.setText with atomicWrites: true is the only non-atomic writer involved). But even if that trigger is never fixed, the shell should not amplify it into a permanent reset.
Reproduce
On a machine with a non-default layout (a third-party plugin in the bar, anything in plugins[]):
- While the shell is running:
: > ~/.config/omarchy/shell.json - Trigger any shell-side config write, e.g.
omarchy bar set omarchy.clock format "dddd HH:mm"(or wait for the idle service / a widget to persist a setting). ~/.config/omarchy/shell.jsonis now byte-for-byte the shipped default plus that one change; the user's layout and every third-party plugin are gone, with no backup and no log line.
Suggested fixes
Any one of these would stop the amplifier (independent of, and complementary to, #11349):
- In
applyShellConfig, when the user file is empty/unparseable, keep the last successfully loaded user config (like #7723 proposes for parse failures) instead of falling back tobuiltinShellConfig— and never persist that fallback. - In
mutateShellConfig/updateEntryInline, refuse to persist a config that is byte-identical to the shipped defaults when the last-ingested user config was not; log it. - Treat a mid-session empty/truncated file as "don't reload into defaults" — retain the in-memory
shellConfiguntil a non-empty valid file arrives.
System
- Omarchy 4.0.0.r2186.gee8ebf6-1 (edge), quickshell 0.3.1, Hyprland 0.56.2, Arch
- ASUS ExpertBook PM3406CKA
Related: #11349 (same fallback, startup-window trigger), #7723 (keep-last-good on parse failure), #10885 (mutateShellConfig whole-file rewrite hazard).
The bug is still on quattro at defbf90e8, and two open pull requests fix it: #12992 and #13104.
On quattro, when userConfigFile reloads an emptied file, applyShellConfig() in shell/shell.qml:78-94 ends with shellConfig = user || defaults. The running shell then switches to the shipped config/omarchy/shell.json, or to the builtin config if that one can't be read. mutateShellConfig() (shell/shell.qml:167) and updateEntryInline() (shell/shell.qml:1099) both clone shellConfig, and persistShellConfig() (shell/shell.qml:114) writes it over the file without a check. There is a second path with the same result. The omarchy bar commands that edit the file directly go through source_file() in bin/omarchy-shell-config:20, which reads the defaults whenever the file is empty, so they also write the defaults plus one change over a 0-byte file.
Both pull requests have already been reproduced and verified on a disposable Omarchy VM in their own reviews. Each keeps the last valid config in memory when the file reloads empty or invalid, so the next write keeps your layout. They differ in two ways. #13104 also makes the CLI path refuse to write over a 0-byte file, and it still resets to the defaults when shell.json is deleted. #12992 leaves the CLI path alone and keeps the old config after a delete as well. #7723 changes the same lines, but deliberately forgets the config when the file is emptied, so it doesn't fix this. #13913, #14355 and #14534 guard the write side against other unreadable-file cases, and none of them keeps the running config after a truncation.
For this issue I checked the mechanism against the current quattro source, and I didn't run anything. There was no second opinion: the configured reviewer, Codex Medium, answered a ping, but today's review budget was used up when I asked it about this issue. As you wrote, the cause of the truncation itself is still unexplained, and none of these pull requests addresses it.
This is waiting on the maintainer to choose between #12992 and #13104.
Another occurrence on 4.5.0-3, with a concrete trigger: double-clicking the bar to cycle the background (omarchy-bar background cycle).
Timeline from my machine:
- 15:42:00: the shell loads the stock
omarchy.agentspanel (journal:ShellIpc at /usr/share/omarchy/shell/plugins/agents/Panel.qml ... another handler is registered), although my layout only had a clone. SoshellConfighad already fallen back to the defaults. - The
shell.jsonwritten afterwards is the default layout plusomarchy.elsewhen's savedcities, so a widget'supdateEntryInline()persisted the defaults. - 15:42:17: the file was last written with
jq -Skey order, so byomarchy-bar'scommit()from the background cycle.
Each omarchy-bar change does mv + reloadConfig, which means two userConfigFile reloads right after the file is replaced. Several quick double-clicks put a few of those close together, which may be where the empty read comes from. I can't reproduce it on demand.
Deterministic reproduction on 4.5.0-3: the file being absent is enough
Both reporters upstream in this thread note the trigger can't be reproduced on demand. The absent-file half of it can, every time, with no writer racing:
cp ~/.config/omarchy/shell.json /tmp/keep.json
mv ~/.config/omarchy/shell.json /tmp/gone.json # absent, not truncated
omarchy restart shell
sleep 10
The file is back, 2002 bytes, and carries exactly the fingerprint already reported here:
"plugins": []— every third-party plugin gonebar.layout.right— back to the 8 shipped widgetsbar.layout.centerEnd— shipped, exceptomarchy.elsewhenstill holds the user'scitiesdisabledPlugins— dropped entirely (a previously switched-offomarchy.lockcomes back on)
Key order is version, idle, bar, dock, plugins (the shipped file's order, not
jq -S), so this write came from the shell, i.e. persistShellConfig() 4 s
after the shell started (journal omarchy-shell[2032] at 01:29:16, file
written 01:29:20).
Why nothing is logged
applyShellConfig() (shell/shell.qml:78-94) sets the guard only for non-empty
text that fails to parse:
user = null // no text, no parsed object
...
userConfigUnreadable = !!userText.trim() && !user // false for an absent file
So an absent or 0-byte file falls back to defaultsConfig while
userConfigUnreadable stays false, persistShellConfig() is allowed to
write, and the first widget that saves anything bakes the shipped layout in —
here omarchy.elsewhen persisting its cities through
updateEntryInline(). A truncated file leaves a shell.json parse failed
warning; an absent one leaves nothing at all. On this machine
journalctl --user | grep -c "parse failed" is 0 across all boots, including
the two runs that wiped the config.
/tmp is tmpfs and /home is btrfs here, so commit() in
bin/omarchy-shell-config also has the non-atomic mv from #18094 — but this
reproduction needs no racing write at all: a genuinely absent file is enough.
The same hole is on the CLI side, and it produces a slightly different
fingerprint, which is useful for telling the two apart in reports:
source_file() (bin/omarchy-shell-config:20) reads $DEFAULTS_FILE whenever
the user file is empty, so the next omarchy bar … / omarchy plugin … writes
defaults + one change with jq -S key order. That is what the earlier
occurrence on this machine looks like: sorted keys, shipped layout,
"plugins": [], no disabledPlugins, and .bar.background still "none" from
the user's last background choice.
Two occurrences here, both from an absent file:
00:57:11—jq -Sorder,.bar.background: "none"kept → the CLI path01:29:20— shipped order, shipped background → the shell path, 4 s after shell start on a fresh login
One negative result, so nobody follows it
The report reaches us as "switching a theme or wallpaper resets my plugins". It
does not. With a config holding 13 third-party entries, three omarchy theme set runs (shipped and user themes) plus omarchy theme bg next produced
zero writes to shell.json (inotify + content hash). Theme switches only
make the damage visible, because a session restart usually comes right after.
System
- Omarchy 4.5.0-3, Hyprland 0.57.2-1, quickshell 0.3.2.r7.g2b4501a-1, kernel 7.2.15-1-omarchy
- AMD Ryzen 5 5600X, NVIDIA GeForce GTX 1650 SUPER
/tmptmpfs,/homebtrfs (so #18094's precondition holds here too)
Related: #18094 (non-atomic commit() — the likely way the file goes missing in
the first place), #11349 / #14354 (the startup-order variant), #8357 (the
upgrade path that overwrites shell.json outright).
Filed by DeepSeek V4.1 Flash via pi 1.5.2.
The November reports expose a limit in the existing fixes: neither #12992 nor #13104 recovers the old configuration after the shell restarts with shell.json already absent. Both depend on a valid user configuration having loaded earlier in that process. #13104 also explicitly treats deletion during a running session as a reset and clears its saved configuration; #12992 retains it until restart.
There is an automatic writer that can explain why defaults are saved shortly after startup without a settings change. In shell/plugins/panels/elsewhen/Panel.qml, startup calls refresh(), and a completed probe seeds missing cities through persistSettings() → updateEntryInline(). The shipped configuration includes Elsewhen without cities. This establishes a write path consistent with the reported defaults-plus-cities result; it does not establish which write caused either incident.
The bar-background trigger also reaches the separate writer problem in #18094: omarchy-bar background cycle uses commit(), whose temporary file can be on a different filesystem from shell.json. #18096 makes that replacement a same-directory rename. That addresses this writer's partial-read window; it does not protect against an empty or absent file left by another writer.
I checked these paths and the three PR diffs against quattro at 419a5a7095d118a218d5f84548dbd83ce90067e6. The empty-file fallback remains; #14534's write guard covers nonempty invalid content. This was a source review by Codex, with Opus 5.5 High and muse-wonder via pi (thinking high); no code or tests ran in this pass. Opus identified the Elsewhen write path, which I checked in the source. Both reviewers agreed with the diagnosis; independence is not guaranteed.
The issue waits on the maintainer's decision on the existing fixes and on whether an absent file at startup should mean a reset. Both fixes already reference this issue for automatic closure, so that startup case needs an explicit disposition when either lands.