chatboxai/chatbox · warning · ChatboxCliUsageError
--style must be vivid or natural.
Error message
--style must be vivid or natural.
What it means
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.
Source
Thrown at src/renderer/packages/chatbox-cli/images.ts:169
return promise
}
async function generateImage(context: ChatboxCliCommandContext): Promise<Record<string, unknown>> {
if (!context.sessionId) throw new ChatboxCliUsageError('Image generation requires an active chat session.')
if (!context.toolCallId) throw new ChatboxCliUsageError('Image generation requires a tool call id.')
const sessionId = context.sessionId
const toolCallId = context.toolCallId
const requestedPrompt = stringFlag(context.parsed, 'prompt') ?? context.parsed.positionals.join(' ').trim()
if (!requestedPrompt) throw new ChatboxCliUsageError('Missing --prompt.')
if (requestedPrompt.length > 8_000) throw new ChatboxCliUsageError('Prompt must be at most 8000 characters.')
const requestedProvider = stringFlag(context.parsed, 'provider')
const requestedModelId = stringFlag(context.parsed, 'model')
const requestedCount = integerFlag(context.parsed, 'count', { defaultValue: 1, min: 1, max: 4 })
const requestedAspectRatio = stringFlag(context.parsed, 'aspect-ratio')
const requestedStyle = stringFlag(context.parsed, 'style')
if (requestedStyle && requestedStyle !== 'vivid' && requestedStyle !== 'natural') {
throw new ChatboxCliUsageError('--style must be vivid or natural.')
}
const parsedStyle: 'vivid' | 'natural' | undefined =
requestedStyle === 'vivid' || requestedStyle === 'natural' ? requestedStyle : undefined
const approvedRequest =
context.approved && context.approvalDetails?.type === 'image_generation' ? context.approvalDetails : undefined
if (
approvedRequest &&
(approvedRequest.prompt !== requestedPrompt ||
approvedRequest.count !== requestedCount ||
approvedRequest.aspectRatio !== requestedAspectRatio ||
approvedRequest.style !== parsedStyle ||
(requestedProvider !== undefined && approvedRequest.provider !== requestedProvider) ||
(requestedModelId !== undefined && approvedRequest.modelId !== requestedModelId))
) {
throw new Error('The image request changed after approval. Ask the user to review it again.')
}
const prompt = approvedRequest?.prompt ?? requestedPromptView on GitHub (pinned to 81571269ad)
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.
Example fix
// before
await executeChatboxCliCommand({ argv: ['image','generate','--prompt', p, '--style','realistic'] }, ctx)
// after
const style = userInput === 'vivid' || userInput === 'natural' ? ['--style', userInput] : []
await executeChatboxCliCommand({ argv: ['image','generate','--prompt', p, ...style] }, ctx) Defensive patterns
Strategy: validation
Validate before calling
const VALID_STYLES = new Set(['vivid', 'natural'])
const style = typeof rawStyle === 'string' ? rawStyle : undefined
if (style !== undefined && !VALID_STYLES.has(style)) {
return { error: '--style must be vivid or natural', kind: 'usage' }
}
const argv = ['image','generate','--prompt', prompt]
if (style) argv.push('--style', style)
await executeChatboxCliCommand({ argv }, ctx) Type guard
function isImageStyle(input: unknown): input is 'vivid' | 'natural' {
return input === 'vivid' || input === 'natural'
} Try / catch
const res = await executeChatboxCliCommand({ argv }, ctx)
if (!res.ok && res.kind === 'usage' && res.error.includes('--style')) {
// correct the style value and retry
} Prevention
- 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.
When it happens
Trigger: Passing --style with an unsupported value such as 'realistic', 'photo', or a misspelling like 'natrual'.
Common situations: An LLM hallucinating a style name, a UI dropdown exposing free text instead of the two options, or locale-translated values passed verbatim.
Related errors
- Image generation requires an active chat session.
- Missing --prompt.
- Image model is not available: ${provider}/${modelId}. Use "c
- Missing image generation record id.
- Missing search query.
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/2a398a0d5ebbab79.
Report an issue: GitHub.