coleam00/Archon · warning
(could not read your per-user prefs — showing install config
Error message
(could not read your per-user prefs — showing install config only)
What it means
readUserPrefsBestEffort prints this notice to stderr when reading the CLI user's AI preferences from the database fails. It is an intentional best-effort fallback: the command continues with install-level config only, and the notice prevents the user from mistaking the listing for 'you have no per-user overrides'.
Source
Thrown at packages/cli/src/commands/ai.ts:459
getLog().error({ err: err as Error, tier, scope: resolvedScope }, 'cli.ai_tier_unset_failed');
console.error(`✗ ${(err as Error).message}`);
return 1;
}
}
/**
* Best-effort read of the CLI user's prefs for listings — `{}` when no CLI
* identity resolves or the DB read fails (solo installs just see config).
*/
async function readUserPrefsBestEffort(): Promise<UserAiPrefs> {
const cliId = resolveCliUserId();
if (!cliId) return {};
try {
const user = await userDb.findOrCreateUserByPlatformIdentity('cli', cliId, cliId);
return await getUserAiPrefs(user.id);
} catch (err) {
getLog().warn({ err: err as Error }, 'cli.ai_user_prefs_read_failed');
// Visible notice so the listing isn't mistaken for "you have no overrides".
console.error('(could not read your per-user prefs — showing install config only)');
return {};
}
}
/** `archon ai tier list [--json]` — show install + per-user scopes and the effective value. */
export async function aiTierListCommand(json?: boolean): Promise<number> {
try {
const config = await loadConfig();
const configured = config.tiers ?? {};
const userPrefs = await readUserPrefsBestEffort();
const userTiers = userPrefs.tiers ?? {};
const effectiveAssistant = userPrefs.defaultProvider ?? config.assistant;
// No options → just the built-in tier-defaults for the default provider.
// Degrade like the route's `tierDefaultsFor` (buildAiProfile ~never throws
// with no aliases, but a defaults lookup must not fail the whole listing).
let defaults: Record<string, RawAliasEntry> = {};
try {View on GitHub (pinned to 0773b97458)
Solutions
- Check the logged warn event 'cli.ai_user_prefs_read_failed' for the underlying error (DB connection, missing table, identity failure)
- Verify the CLI is configured and can reach the server (`archon` setup / connection settings)
- Run any pending server migrations so user/prefs tables exist and match the binary
- Re-run the command once the DB is reachable; per-user prefs will be included again
Defensive patterns
Strategy: fallback
Validate before calling
// best-effort read with explicit notice
let prefs = {};
try { prefs = await readUserPrefsBestEffort(cliId); }
catch { console.error('(could not read your per-user prefs — showing install config only)'); } Try / catch
try {
prefs = await getUserAiPrefs(user.id);
} catch (err) {
getLog().warn({ err }, 'cli.ai_user_prefs_read_failed');
prefs = {}; // install config only
} Prevention
- Ensure CLI identity is configured before running `archon ai` commands
- Keep server and CLI versions in sync so prefs tables exist
- Monitor the 'cli.ai_user_prefs_read_failed' warn event
- Treat empty prefs output as suspect when the DB is known to be flaky
When it happens
Trigger: Running an `archon ai` command (e.g. `archon ai tier list`) while getUserAiPrefs or findOrCreateUserByPlatformIdentity('cli', cliId, cliId) throws — no CLI identity configured, DB unavailable/corrupt, or schema/migration mismatch.
Common situations: Fresh install with no `archon` CLI identity yet; server DB unreachable; developer pointing the CLI at a different environment than the server.
Related errors
- Cannot create worktree: database lookup failed. Error: ${res
- Cannot create worktree: repository registration failed. Erro
- Failed to access database: ${err.message} Hint: Check that D
- Failed to create the workflow run: ${(error as Error).messag
- Cannot resume: Database lookup failed. Error: ${codebaseLook
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/a26c21a0b34e5e68.
Report an issue: GitHub.