{"record":{"id":"2a398a0d5ebbab79","repo":"chatboxai/chatbox","slug":"style-must-be-vivid-or-natural","errorCode":null,"errorMessage":"--style must be vivid or natural.","messagePattern":"--style must be vivid or natural\\.","errorType":"validation","errorClass":"ChatboxCliUsageError","httpStatus":null,"severity":"warning","filePath":"src/renderer/packages/chatbox-cli/images.ts","lineNumber":169,"sourceCode":"  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 ||\n      approvedRequest.aspectRatio !== requestedAspectRatio ||\n      approvedRequest.style !== parsedStyle ||\n      (requestedProvider !== undefined && approvedRequest.provider !== requestedProvider) ||\n      (requestedModelId !== undefined && approvedRequest.modelId !== requestedModelId))\n  ) {\n    throw new Error('The image request changed after approval. Ask the user to review it again.')\n  }\n\n  const prompt = approvedRequest?.prompt ?? requestedPrompt","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/packages/chatbox-cli/images.ts#L151-L187","documentation":"ChatboxCliUsageError thrown when --style is provided but is neither 'vivid' nor 'natural'. These are the only two supported DALL-E style modes; any other value (including typos and localized variants) is rejected before provider resolution.","triggerScenarios":"Passing --style with an unsupported value such as 'realistic', 'photo', or a misspelling like 'natrual'.","commonSituations":"An LLM hallucinating a style name, a UI dropdown exposing free text instead of the two options, or locale-translated values passed verbatim.","solutions":["Use exactly 'vivid' or 'natural', or omit --style to accept the provider default.","Constrain the caller's UI to a fixed list of the two valid values.","Normalize/validate the style value before dispatching and prompt the user if invalid."],"exampleFix":"// before\nawait executeChatboxCliCommand({ argv: ['image','generate','--prompt', p, '--style','realistic'] }, ctx)\n\n// after\nconst style = userInput === 'vivid' || userInput === 'natural' ? ['--style', userInput] : []\nawait executeChatboxCliCommand({ argv: ['image','generate','--prompt', p, ...style] }, ctx)","handlingStrategy":"validation","validationCode":"const VALID_STYLES = new Set(['vivid', 'natural'])\nconst style = typeof rawStyle === 'string' ? rawStyle : undefined\nif (style !== undefined && !VALID_STYLES.has(style)) {\n  return { error: '--style must be vivid or natural', kind: 'usage' }\n}\nconst argv = ['image','generate','--prompt', prompt]\nif (style) argv.push('--style', style)\nawait executeChatboxCliCommand({ argv }, ctx)","typeGuard":"function isImageStyle(input: unknown): input is 'vivid' | 'natural' {\n  return input === 'vivid' || input === 'natural'\n}","tryCatchPattern":"const res = await executeChatboxCliCommand({ argv }, ctx)\nif (!res.ok && res.kind === 'usage' && res.error.includes('--style')) {\n  // correct the style value and retry\n}","preventionTips":["Restrict the UI to a fixed list of 'vivid' and 'natural'.","Omit --style to accept the provider default when unsure.","Normalize the style value before dispatching."],"tags":["chatbox-cli","usage","image-generation","validation","enums"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}