chatboxai/chatbox · warning · ChatboxCliUsageError
Conversation not found: ${sessionId}
Error message
Conversation not found: ${sessionId} What it means
ChatboxCliUsageError thrown by 'chats read' after chatStore.getSession(sessionId) returns a falsy value. Although classified as a usage error (kind:'usage'), it reflects a data-lookup miss: the supplied id does not match any persisted conversation.
Source
Thrown at src/renderer/packages/chatbox-cli/chats.ts:106
...compactMessage(message),
})
}
}
})
return { scope: 'global', query, hits, limitReached: hits.length >= limit }
},
},
{
path: ['chats', 'read'],
description: 'Read compact user/assistant messages from one conversation without approval.',
usage: 'chatbox chats read <session-id> [--limit 20] [--cursor 0]',
async execute({ parsed }) {
const sessionId = parsed.positionals[0]
if (!sessionId) throw new ChatboxCliUsageError('Missing session id.')
const limit = integerFlag(parsed, 'limit', { defaultValue: 20, min: 1, max: 50 })
const cursor = integerFlag(parsed, 'cursor', { defaultValue: 0, min: 0, max: 10_000_000 })
const session = await chatStore.getSession(sessionId)
if (!session) throw new ChatboxCliUsageError(`Conversation not found: ${sessionId}`)
const messages = readableMessages(session)
const page = messages.slice(cursor, cursor + limit)
return {
scope: 'session',
session: { id: session.id, name: session.name, type: session.type ?? 'chat' },
messages: page.map(({ message, thread }) => compactMessage(message, thread)),
nextCursor: cursor + page.length < messages.length ? cursor + page.length : null,
total: messages.length,
}
},
},
]
View on GitHub (pinned to 81571269ad)
Solutions
- Re-fetch the id list via ['chats','list'] and use a current id.
- Verify the id belongs to the active account/device before reading.
- Handle the { ok:false, kind:'usage' } result by prompting the user to pick a valid conversation.
Example fix
// before
await executeChatboxCliCommand({ argv: ['chats', 'read', staleId] }, ctx)
// after
const res = await executeChatboxCliCommand({ argv: ['chats', 'read', id] }, ctx)
if (!res.ok && res.kind === 'usage') {
const list = await executeChatboxCliCommand({ argv: ['chats', 'list'] }, ctx)
// surface list to the user and retry with a chosen id
} Defensive patterns
Strategy: validation
Validate before calling
// Verify the id exists before issuing the read by listing first,
// or simply handle the usage result and re-list.
const list = await executeChatboxCliCommand({ argv: ['chats','list'] }, ctx)
const known = new Set(list.items.map((s) => s.id))
if (!known.has(sessionId)) {
return { error: 'Conversation not found locally', kind: 'usage' }
}
await executeChatboxCliCommand({ argv: ['chats','read', sessionId] }, ctx) Try / catch
const res = await executeChatboxCliCommand({ argv: ['chats','read', id] }, ctx)
if (!res.ok && res.kind === 'usage' && res.error.startsWith('Conversation not found')) {
// re-list and prompt the user to pick a current conversation
} Prevention
- Do not cache session ids long-term; re-list when a lookup misses.
- Confirm the id belongs to the active account/device before reading.
- Handle the usage result by prompting for a fresh selection.
When it happens
Trigger: A session id that was deleted, never existed, is from another device/account, or is mistyped. Also possible after a store reset/migration that changed ids.
Common situations: Stale ids cached in a UI, cross-device sync where the conversation is absent locally, post-migration id format changes, or copy/paste typos.
Related errors
- Missing search query.
- Missing session id.
- Image generation record not found: ${recordId}
- Image generation requires an active chat session.
- Missing --prompt.
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/7d578bf7b1d683ed.
Report an issue: GitHub.