{"record":{"id":"a734f86a6be81cb0","repo":"chatboxai/chatbox","slug":"missing-session-id","errorCode":null,"errorMessage":"Missing session id.","messagePattern":"Missing session id\\.","errorType":"validation","errorClass":"ChatboxCliUsageError","httpStatus":null,"severity":"warning","filePath":"src/renderer/packages/chatbox-cli/chats.ts","lineNumber":102,"sourceCode":"            if (!isReadableConversationMessage(message)) continue\n            hits.push({\n              sessionId: session.id,\n              sessionName: session.name,\n              ...compactMessage(message),\n            })\n          }\n        }\n      })\n      return { scope: 'global', query, hits, limitReached: hits.length >= limit }\n    },\n  },\n  {\n    path: ['chats', 'read'],\n    description: 'Read compact user/assistant messages from one conversation without approval.',\n    usage: 'chatbox chats read <session-id> [--limit 20] [--cursor 0]',\n    async execute({ parsed }) {\n      const sessionId = parsed.positionals[0]\n      if (!sessionId) throw new ChatboxCliUsageError('Missing session id.')\n      const limit = integerFlag(parsed, 'limit', { defaultValue: 20, min: 1, max: 50 })\n      const cursor = integerFlag(parsed, 'cursor', { defaultValue: 0, min: 0, max: 10_000_000 })\n      const session = await chatStore.getSession(sessionId)\n      if (!session) throw new ChatboxCliUsageError(`Conversation not found: ${sessionId}`)\n\n      const messages = readableMessages(session)\n      const page = messages.slice(cursor, cursor + limit)\n      return {\n        scope: 'session',\n        session: { id: session.id, name: session.name, type: session.type ?? 'chat' },\n        messages: page.map(({ message, thread }) => compactMessage(message, thread)),\n        nextCursor: cursor + page.length < messages.length ? cursor + page.length : null,\n        total: messages.length,\n      }\n    },\n  },\n]\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/packages/chatbox-cli/chats.ts#L84-L120","documentation":"ChatboxCliUsageError thrown by the 'chats read' command when parsed.positionals[0] is falsy (undefined or empty). It is a usage error returned as { ok:false, kind:'usage' } by the CLI executor; the command requires exactly one session-id positional before it touches the store.","triggerScenarios":"Invoking chats read with no arguments, or with an empty first positional.","commonSituations":"An LLM tool-call that forgot the id, a UI button wired without a selected conversation, or a recovery script missing the id.","solutions":["Pass a session id as the first positional, e.g. ['chats','read','<sessionId>'].","List sessions first with ['chats','list'] to obtain a valid id when unknown.","Validate the id is a non-empty string in the caller before dispatching."],"exampleFix":"// before\nawait executeChatboxCliCommand({ argv: ['chats', 'read'] }, ctx)\n\n// after\nif (!sessionId) return promptUser('Select a conversation')\nawait executeChatboxCliCommand({ argv: ['chats', 'read', sessionId] }, ctx)","handlingStrategy":"validation","validationCode":"const sessionId = String(rawId ?? '').trim()\nif (!sessionId) {\n  return { error: 'A session id is required', kind: 'usage' }\n}\nawait executeChatboxCliCommand({ argv: ['chats', 'read', sessionId] }, ctx)","typeGuard":"function isSessionId(input: unknown): input is string {\n  return typeof input === 'string' && input.trim().length > 0\n}","tryCatchPattern":"const res = await executeChatboxCliCommand({ argv: ['chats','read', id] }, ctx)\nif (!res.ok && res.kind === 'usage' && res.error.startsWith('Missing session id')) {\n  // prompt the user to select a conversation\n}","preventionTips":["Always pass a non-empty session id as the first positional.","Use ['chats','list'] to obtain a valid id when unknown.","Validate the id is non-empty in the caller before dispatching."],"tags":["chatbox-cli","usage","validation","chats"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}