coleam00/Archon · warning
Could not write default assistant config: ${e.message}${code
Error message
Could not write default assistant config: ${e.message}${code} What it means
A non-fatal warning emitted during `archon setup` when writing the default assistant configuration (to ~/.archon/config.yaml via writeInstallDefaults) fails. Setup catches the error, logs it, and returns false so the user can later run `archon ai default <provider> [<model>]`. The message embeds the underlying error text and, when present, the Node.js errno code (e.g. EACCES, ENOSPC) to pinpoint the cause.
Source
Thrown at packages/cli/src/commands/setup.ts:760
* aborting setup. Returns true when the config was written.
*
* The `write` parameter is injected in tests (same convention as
* checkPiModule's loader) so this path is testable without `mock.module()`.
*/
export async function writeInstallDefaults(
ai: SetupConfig['ai'],
write: (provider: string, model?: string) => Promise<void> = setInstallDefault
): Promise<boolean> {
if (!ai.defaultAssistantSelected) return false;
try {
await write(ai.defaultAssistant, ai.defaultModel);
return true;
} catch (err) {
// Non-fatal: the user can run `archon ai default <provider> [<model>]`
// later. Surface, don't swallow.
const e = err as NodeJS.ErrnoException;
const code = e.code ? ` (${e.code})` : '';
log.warning(`Could not write default assistant config: ${e.message}${code}`);
getLog().warn({ err: e }, 'setup.default_assistant_config_write_failed');
return false;
}
}
/**
* Verify the Pi npm module is loadable. Pi is bundled as a transitive dep of
* `@archon/providers` so this should always pass, but catching broken compiled
* builds at setup time is preferable to a silent runtime failure.
*
* The `loader` parameter is injected in tests so we don't need
* `mock.module()` on `@archon/providers` (which would pollute other tests).
*/
export async function checkPiModule(
loader: () => Promise<unknown> = () => import('@archon/providers')
): Promise<{ ok: boolean; error?: string }> {
try {
await loader();View on GitHub (pinned to 0773b97458)
Solutions
- Check the errno code in the warning: fix permissions with `sudo chown -R $(whoami) ~/.archon` for EACCES/EPERM, or free disk space for ENOSPC.
- Run `archon ai default <provider> [<model>]` after fixing the environment to write the default assistant config directly.
- Hand-edit ~/.archon/config.yaml to set the default assistant/model if automated writes keep failing.
- Re-run `archon setup` once the underlying filesystem problem is resolved.
Example fix
// before (root-owned config blocks write) -rw------- root root ~/.archon/config.yaml // after sudo chown -R $(whoami):$(id -gn) ~/.archon archon ai default anthropic claude-sonnet-4
Defensive patterns
Strategy: validation
Validate before calling
const cfg = path.join(os.homedir(), '.archon', 'config.yaml');
fs.mkdirSync(path.dirname(cfg), { recursive: true });
fs.accessSync(path.dirname(cfg), fs.constants.W_OK);
if (fs.existsSync(cfg)) YAML.parse(fs.readFileSync(cfg, 'utf8')); // throws early if corrupt Try / catch
try {
writeInstallDefaults(prefs);
} catch (e) {
const err = e as NodeJS.ErrnoException;
log.warn(`default assistant config not written (${err.code ?? 'unknown'}): ${err.message}. Run: archon ai default <provider> [<model>]`);
} Prevention
- Check writability of ~/.archon before setup (touch a file).
- Never run setup with sudo; fix ownership with chown instead.
- Keep free disk headroom on the home filesystem.
- Validate ~/.archon/config.yaml parses as YAML before programmatic writes.
When it happens
Trigger: Running `archon setup` and choosing to configure a default assistant when the write to the config file fails: unwritable ~/.archon directory, disk full, config.yaml corrupted/unparseable by the YAML writer, or a race with another writer holding the file.
Common situations: Home directory permissions changed after running as another user (root-created ~/.archon), read-only or full disk, antivirus/file-sync locking the config file, or a partially-written config.yaml left by a crashed setup.
Related errors
- Pi shim setup failed at ${shimDir}: ${err.message}
- Could not write Pi model config: ${e.message}${code}
- Could not create ${bootstrapResult.path}: ${bootstrapResult.
- Failed to set up GitHub conversation - please try again
- tar extraction failed (exit ${exitCode}): ${details}
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/b88fd87dcbf7fd97.
Report an issue: GitHub.