coleam00/Archon · error · ConversationNotFoundError
Conversation not found: ${conversationId}
Error message
Conversation not found: ${conversationId} What it means
updateConversation builds a dynamic UPDATE on remote_agent_conversations and throws ConversationNotFoundError('Conversation not found: ${conversationId}') when the UPDATE matched zero rows. It is a typed, catchable error (name 'ConversationNotFoundError', carries conversationId) used by platform adapters to detect deleted conversations.
Source
Thrown at packages/core/src/db/conversations.ts:186
values.push(updates.hidden ? 1 : 0);
}
if (fields.length === 0) {
return; // No updates
}
const dialect = getDialect();
fields.push(`updated_at = ${dialect.now()}`);
values.push(id);
const result = await pool.query(
`UPDATE remote_agent_conversations SET ${fields.join(', ')} WHERE id = $${String(i)}`,
values
);
if (result.rowCount === 0) {
getLog().error({ conversationId: id, fields, updates }, 'db.conversation_update_not_found');
throw new ConversationNotFoundError(id);
}
}
/**
* Find a conversation by isolation environment ID (legacy - single result)
* Used for provider-based lookup and shared environment detection
*/
export async function getConversationByIsolationEnvId(envId: string): Promise<Conversation | null> {
const result = await pool.query<Conversation>(
'SELECT * FROM remote_agent_conversations WHERE isolation_env_id = $1 LIMIT 1',
[envId]
);
return result.rows[0] ?? null;
}
/**
* Find all conversations using a specific isolation environment (new UUID model)
*/View on GitHub (pinned to 0773b97458)
Solutions
- Confirm existence: SELECT id, deleted_at FROM remote_agent_conversations WHERE id='<id>';
- If soft-deleted and that's unintended, clear deleted_at or create a new conversation and migrate the thread reference.
- Update the caller to treat ConversationNotFoundError as 'conversation gone' — stop updating or recreate the conversation.
- Check the id source (webhook, cache, config) for staleness or truncation; log the full id being used.
- Verify the app is pointed at the intended database — the id may exist in another environment.
Example fix
// before (from the adapters' pattern)
await updateConversation(id, { status: 'failed' });
// after
try {
await updateConversation(id, { status: 'failed' });
} catch (e) {
if (e instanceof ConversationNotFoundError) {
logger.warn({ conversationId: id }, 'conversation vanished; skipping update');
return;
}
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
const { rows } = await pool.query('SELECT 1 FROM remote_agent_conversations WHERE id = $1 AND deleted_at IS NULL', [id]);
if (rows.length === 0) throw new ConversationNotFoundError(id); // handle before calling updateConversation Type guard
function isConversationNotFound(e: unknown): e is ConversationNotFoundError {
return e instanceof ConversationNotFoundError;
} Try / catch
try {
await updateConversation(id, fields);
} catch (e) {
if (isConversationNotFound(e)) {
log.warn({ conversationId: id }, 'conversation gone; skipping update');
return; // or recreate the conversation
}
throw e;
} Prevention
- Existence-check (including deleted_at IS NULL) before bulk or batch updates.
- Handle ConversationNotFoundError in adapters so deleted conversations skip updates instead of failing the run.
- Avoid holding conversation ids across database resets; re-resolve from the thread mapping.
- Log the id (db.conversation_update_not_found) when it happens to spot stale webhook payloads.
When it happens
Trigger: Calling updateConversation with a conversation id absent from remote_agent_conversations — already soft-deleted (deleted_at set), purged, wrong id, or an id from a different database/environment.
Common situations: Conversation deleted in another tab/operator session while a chat still tries to persist state; stale id after a database reset; adapters (GitHub/GitLab/Gitea) resuming threads whose conversation rows were removed; typo'd or truncated id passed from a webhook payload.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Codebase ${codebaseId} not found
- Corrupt commands JSON for codebase ${id}: unable to parse st
- Failed to get workflow run status: ${err.message}
- Failed to get active workflow run: ${err.message}
- Failed to get active workflow run by path: ${err.message}
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/b3cd9960d333e539.
Report an issue: GitHub.