coleam00/Archon · error · Error

Failed to update conversation: ${err.message}

Error message

Failed to update conversation: ${err.message}

What it means

After creating a workflow run, the CLI updates the conversation record (cwd, codebase_id, isolation_env_id); if that persistence call throws, the error is re-thrown as 'Failed to update conversation: <message>'. It is a boundary wrap so operators know the failure happened during conversation bookkeeping, not workflow execution.

Source

Thrown at packages/cli/src/commands/workflow.ts:2736

  }

  // The lane's checkout is final here — reuse-worktree set it in the lane block, and
  // checkout-branch when the resolver materialized its exact branch above.
  if (adoptLaneRunsIsolatedCheckout) {
    console.log(`Capturing workflow source from ${workingCwd}.`);
    await recaptureForLane(workingCwd);
  }

  // Update conversation with cwd and isolation info
  try {
    await conversationDb.updateConversation(conversation.id, {
      cwd: workingCwd,
      codebase_id: codebase?.id ?? null,
      isolation_env_id: isolationEnvId ?? null,
    });
  } catch (error) {
    const err = error as Error;
    throw new Error(`Failed to update conversation: ${err.message}`);
  }

  // Wire adapter for assistant message persistence
  adapter.setConversationDbId(conversationId, conversation.id);

  // Resolve the CLI user once (ARCHON_USER_ID, else $USER/$USERNAME). When set,
  // upsert via the `cli` platform identity so the same Archon user is reused
  // across invocations — this is what attributes the workflow run to the human
  // running the command and what `getUserProviderEnv` keys on for per-user
  // AI-provider credentials (#1891 Phase 2).
  const cliUserId = await resolveCliUserRecordId();

  // Persist user message for Web UI history.
  try {
    await messageDb.addMessage(conversation.id, 'user', userMessage, undefined, cliUserId);
  } catch (error) {
    getLog().warn(
      { err: error as Error, conversationId: conversation.id },

View on GitHub (pinned to 0773b97458)

Solutions

  1. Re-run the command; transient DB locks usually clear.
  2. Check database connectivity/config (DSN, database file location).
  3. Verify the database schema is current for the binary version (see database docs).
  4. Inspect the logged original error to find the underlying persistence failure before retrying.

Example fix

// before
throw new Error(`Failed to update conversation: ${err.message}`);
// after
getLog().error({ err, conversationId: conversation.id }, 'cli.conversation_update_failed');
throw new Error(`Failed to update conversation ${conversation.id}: ${err.message}`);
Defensive patterns

Strategy: try-catch

Validate before calling

// verify DB reachable and conversation exists before updating
const db = conversation.id ? await store.getConversation(conversation.id) : null;
if (!db) throw new Error(`Conversation ${conversation.id} not found; skipping update`);

Type guard

function isDbError(e: unknown): e is Error & { code?: string } {
  return e instanceof Error && 'code' in e;
}

Try / catch

try {
  await store.updateConversation(conversation.id, { cwd: workingCwd, codebase_id: codebase?.id ?? null, isolation_env_id: isolationEnvId ?? null });
} catch (error) {
  const err = error as Error;
  getLog().error({ err, conversationId: conversation.id }, 'cli.conversation_update_failed');
  throw new Error(`Failed to update conversation: ${err.message}`);
}

Prevention

When it happens

Trigger: The conversation update call (persisting cwd/codebase_id/isolation_env_id for the just-created conversation) throws — typically a database lock, connection failure, schema mismatch, or a constraint violation for the codebase or isolation env IDs.

Common situations: SQLite database locked by another concurrent archon process; PostgreSQL unreachable after a network change; running an older binary against a newer database (or vice versa) so columns like isolation_env_id are missing.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/84aa37f12038649e. Report an issue: GitHub.