can1357/oh-my-pi · error
Settings config is invalid and could not be moved aside: ${f
Error message
Settings config is invalid and could not be moved aside: ${filePath}; refusing to overwrite it: ${String(error)} What it means
Thrown by #quarantineInvalidYamlLocked when the invalid settings YAML cannot be renamed to a .broken-* backup path (fs.rename failed). The loader will not overwrite a file it could not move aside, since that would irrecoverably destroy the user's (broken) settings. The original rename error is embedded via String(error).
Source
Thrown at packages/coding-agent/src/config/settings.ts:1473
if (result.kind === "invalid") {
result = await this.#quarantineInvalidYamlLocked(writePath, result);
this.#quarantinedYamlTargets.set(filePath, writePath);
}
return {
settings: this.#unwrapYamlLoadResult(filePath, result),
generation,
};
}
async #quarantineInvalidYamlLocked(
filePath: string,
result: Extract<YamlLoadResult, { kind: "invalid" }>,
): Promise<Extract<YamlLoadResult, { kind: "invalid" }>> {
const backupPath = `${filePath}.broken-${Date.now()}-${process.pid}-${randomUUID()}`;
try {
await fs.promises.rename(filePath, backupPath);
} catch (error) {
throw new Error(
`Settings config is invalid and could not be moved aside: ${filePath}; refusing to overwrite it: ${String(error)}`,
);
}
logger.warn("Settings: moved invalid config aside", {
path: filePath,
backupPath,
error: String(result.error),
});
return { ...result, backupPath };
}
#unwrapYamlLoadResult(filePath: string, result: YamlLoadResult): RawSettings | null {
switch (result.kind) {
case "missing":
return null;
case "loaded":
return result.settings;
case "invalid":View on GitHub (pinned to 9690622007)
Solutions
- Fix file permissions on the settings file and its directory (make writable by the running user)
- Check for processes locking the file (editors, antivirus, sync clients) and retry
- Manually rename or fix the invalid file, then re-run
- Free disk space if the filesystem is full
Example fix
// before $ ls -l ~/.omp/settings.yaml # -r--r--r-- // after $ chmod u+w ~/.omp/settings.yaml
Defensive patterns
Strategy: try-catch
Validate before calling
async function settingsWritable(path) {
try { await fs.promises.access(path, fs.constants.W_OK); return true; } catch { return false; }
} Try / catch
try { await settings.load(); } catch (e) {
if (String(e).includes('could not be moved aside')) {
logger.error('Fix permissions/locks on settings file, then retry', { error: e });
} else throw e;
} Prevention
- Ensure ~/.omp and its files are owned and writable by the running user
- Exclude the config directory from antivirus/sync tools that hold locks
- Keep sufficient disk space on the volume holding the config
When it happens
Trigger: Quarantine path executed while the settings file is not renamable: permission denied, read-only filesystem, the file is locked by the OS (Windows AV/indexer), or the directory is no longer writable.
Common situations: settings.yaml owned by another user or made read-only; synced/cloud folders holding ephemeral locks; disk full preventing directory updates.
Related errors
- Failed to read settings config ${filePath}: ${String(result.
- Settings config was invalid before locking and is now missin
- URL reads are disabled by settings.
- {}: {error}
- inter-device move failed: {} to {}; unable to remove target:
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/a678c1bf10d4e183.
Report an issue: GitHub.