{"record":{"id":"ed890821bc622ee9","repo":"chatboxai/chatbox","slug":"missing-prompt","errorCode":null,"errorMessage":"Missing --prompt.","messagePattern":"Missing --prompt\\.","errorType":"validation","errorClass":"ChatboxCliUsageError","httpStatus":null,"severity":"warning","filePath":"src/renderer/packages/chatbox-cli/images.ts","lineNumber":160,"sourceCode":"  const promise = create()\n  executionCache.set(key, { signature, promise })\n  void promise.catch(() => {\n    if (executionCache.get(key)?.promise === promise) executionCache.delete(key)\n  })\n  if (executionCache.size > 100) {\n    const oldest = executionCache.keys().next().value\n    if (typeof oldest === 'string') executionCache.delete(oldest)\n  }\n  return promise\n}\n\nasync function generateImage(context: ChatboxCliCommandContext): Promise<Record<string, unknown>> {\n  if (!context.sessionId) throw new ChatboxCliUsageError('Image generation requires an active chat session.')\n  if (!context.toolCallId) throw new ChatboxCliUsageError('Image generation requires a tool call id.')\n  const sessionId = context.sessionId\n  const toolCallId = context.toolCallId\n  const requestedPrompt = stringFlag(context.parsed, 'prompt') ?? context.parsed.positionals.join(' ').trim()\n  if (!requestedPrompt) throw new ChatboxCliUsageError('Missing --prompt.')\n  if (requestedPrompt.length > 8_000) throw new ChatboxCliUsageError('Prompt must be at most 8000 characters.')\n\n  const requestedProvider = stringFlag(context.parsed, 'provider')\n  const requestedModelId = stringFlag(context.parsed, 'model')\n  const requestedCount = integerFlag(context.parsed, 'count', { defaultValue: 1, min: 1, max: 4 })\n  const requestedAspectRatio = stringFlag(context.parsed, 'aspect-ratio')\n  const requestedStyle = stringFlag(context.parsed, 'style')\n  if (requestedStyle && requestedStyle !== 'vivid' && requestedStyle !== 'natural') {\n    throw new ChatboxCliUsageError('--style must be vivid or natural.')\n  }\n  const parsedStyle: 'vivid' | 'natural' | undefined =\n    requestedStyle === 'vivid' || requestedStyle === 'natural' ? requestedStyle : undefined\n  const approvedRequest =\n    context.approved && context.approvalDetails?.type === 'image_generation' ? context.approvalDetails : undefined\n  if (\n    approvedRequest &&\n    (approvedRequest.prompt !== requestedPrompt ||\n      approvedRequest.count !== requestedCount ||","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/packages/chatbox-cli/images.ts#L142-L178","documentation":"ChatboxCliUsageError thrown by generateImage when requestedPrompt is empty. requestedPrompt is stringFlag(parsed,'prompt') falling back to the joined positionals; both being empty means the generate command has nothing to render.","triggerScenarios":"Calling 'image generate' with no --prompt flag and no positional text, or with --prompt '' and no positionals.","commonSituations":"An LLM tool-call that omitted the prompt, a UI that submitted before the user typed, or a script with an empty prompt variable.","solutions":["Always supply a non-empty --prompt (or a positional) with the desired text.","Validate the prompt is non-empty in the caller and prompt the user if blank.","Remember the 8000-character cap when constructing the prompt."],"exampleFix":"// before\nawait executeChatboxCliCommand({ argv: ['image','generate'] }, ctx)\n\n// after\nif (!prompt.trim()) return promptUser('Describe the image to generate')\nawait executeChatboxCliCommand({ argv: ['image','generate','--prompt', prompt] }, ctx)","handlingStrategy":"validation","validationCode":"const prompt = String(rawPrompt ?? '').trim()\nif (!prompt) {\n  return { error: 'A prompt is required', kind: 'usage' }\n}\nif (prompt.length > 8_000) {\n  return { error: 'Prompt must be at most 8000 characters', kind: 'usage' }\n}\nawait executeChatboxCliCommand({ argv: ['image','generate','--prompt', prompt] }, ctx)","typeGuard":"function isValidPrompt(input: unknown): input is string {\n  return typeof input === 'string' && input.trim().length > 0 && input.length <= 8_000\n}","tryCatchPattern":"const res = await executeChatboxCliCommand({ argv: ['image','generate','--prompt', p] }, ctx)\nif (!res.ok && res.kind === 'usage' && res.error === 'Missing --prompt.') {\n  // prompt the user for image text\n}","preventionTips":["Always supply a non-empty --prompt with the desired text.","Enforce the 8000-character cap in the caller.","Validate the prompt is non-empty before dispatching."],"tags":["chatbox-cli","usage","image-generation","validation"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}