chatboxai/chatbox · warning · ChatboxCliUsageError

Missing image generation record id.

Error message

Missing image generation record id.

What it means

ChatboxCliUsageError thrown by the 'image status' command when parsed.positionals[0] is falsy. The command requires exactly one record-id positional to look up a stored image-generation record.

Source

Thrown at src/renderer/packages/chatbox-cli/images.ts:358

    }
  })
}

export const imageCommands: ChatboxCliCommandDefinition[] = [
  {
    path: ['image', 'generate'],
    description: 'Request approval, then start a callback-driven image background task. Never poll for completion.',
    usage:
      'chatbox image generate --prompt <text> [--provider <id>] [--model <id>] [--count 1] [--aspect-ratio <ratio>]',
    execute: generateImage,
  },
  {
    path: ['image', 'status'],
    description: 'Read an image generation record.',
    usage: 'chatbox image status <record-id>',
    async execute({ parsed }) {
      const recordId = parsed.positionals[0]
      if (!recordId) throw new ChatboxCliUsageError('Missing image generation record id.')
      const record = await platform.getImageGenerationStorage().getById(recordId)
      if (!record) throw new ChatboxCliUsageError(`Image generation record not found: ${recordId}`)
      return compactRecord(record)
    },
  },
  {
    path: ['image', 'history'],
    description: 'List recent image generation records.',
    usage: 'chatbox image history [--limit 10] [--cursor 0]',
    async execute({ parsed }) {
      const limit = integerFlag(parsed, 'limit', { defaultValue: 10, min: 1, max: 20 })
      const cursor = integerFlag(parsed, 'cursor', { defaultValue: 0, min: 0, max: 10_000_000 })
      const page = await platform.getImageGenerationStorage().getPage(cursor, limit)
      return {
        scope: 'global',
        items: page.items.map(compactRecord),
        nextCursor: page.nextCursor,
        total: page.total,

View on GitHub (pinned to 81571269ad)

Solutions

  1. Pass the record id returned by the generate callback as the first positional.
  2. If the id is unknown, list recent records with ['image','history'] first.
  3. Validate the id is non-empty before dispatching.

Example fix

// before
await executeChatboxCliCommand({ argv: ['image','status'] }, ctx)

// after
if (!recordId) return runImageHistoryFirst()
await executeChatboxCliCommand({ argv: ['image','status', recordId] }, ctx)
Defensive patterns

Strategy: validation

Validate before calling

const recordId = String(rawId ?? '').trim()
if (!recordId) {
  return { error: 'A record id is required', kind: 'usage' }
}
await executeChatboxCliCommand({ argv: ['image','status', recordId] }, ctx)

Type guard

function isRecordId(input: unknown): input is string {
  return typeof input === 'string' && input.trim().length > 0
}

Try / catch

const res = await executeChatboxCliCommand({ argv: ['image','status', id] }, ctx)
if (!res.ok && res.kind === 'usage' && res.error.startsWith('Missing image generation record id')) {
  // obtain the id from the generate callback or image history
}

Prevention

When it happens

Trigger: Calling 'image status' with no arguments, or with an empty first positional.

Common situations: An LLM calling status without the callback-provided id, or a script missing the record id.

Related errors


AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12). Data as JSON: /api/errors/2ac7b1a67cd78afe. Report an issue: GitHub.