Following up on our above report, confirming this still reproduces on Cloudron 9.2.0, with the exact spot in the source in case it helps.
We hit it on a real app backup just now:
App backup error: Backup failed: Cannot read properties of null (reading 'sort')
It reproduced on the second backup attempt under active ClickHouse merge load, so the race window isn't narrow.
9.2.0 does add a guard, but it sits after the .sort(). In box/src/syncer.js, readTree is:
const names = safe.fs.readdirSync(dirPath).sort(); // line 31
if (!names) return []; // line 32
@cloudron/safetydance's readdirSync returns null on a vanished directory (the ENOENT when a ClickHouse tmp_merge_* part is renamed/removed mid-snapshot). So line 31 evaluates null.sort() and throws before the line-32 if (!names) guard can run — the guard is dead code for this crash, and the whole-server backup run still aborts.
The fix is to null-check before .sort():
const names = safe.fs.readdirSync(dirPath);
if (!names) return [];
names.sort();
(or (safe.fs.readdirSync(dirPath) || []).sort()). The same file's readCache (around lines 22–23) already does it in this order — assign, null-check, then use — so this just makes readTree consistent with the existing pattern in the file.
Happy to test a patch against a live ClickHouse-bundling app under merge load.