chatboxai/chatbox · warning · ChatboxCliUsageError

Image generation record not found: ${recordId}

Error message

Image generation record not found: ${recordId}

What it means

ChatboxCliUsageError thrown by 'image status' after platform.getImageGenerationStorage().getById(recordId) returns null. Classified as usage (kind:'usage'), it indicates the supplied record id does not match any stored image-generation record.

Source

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

}

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. List recent records via ['image','history'] and use a current id.
  2. Confirm the id belongs to the active account/device before reading.
  3. Handle the { ok:false, kind:'usage' } result by prompting the user to pick a valid record.

Example fix

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

// after
const res = await executeChatboxCliCommand({ argv: ['image','status', id] }, ctx)
if (!res.ok && res.kind === 'usage') {
  const hist = await executeChatboxCliCommand({ argv: ['image','history'] }, ctx)
  // surface history to the user and retry with a chosen record id
}
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the record exists by listing history before reading a single record.
const hist = await executeChatboxCliCommand({ argv: ['image','history'] }, ctx)
const known = new Set(hist.items.map((r) => r.id))
if (!known.has(recordId)) {
  return { error: 'Record not found locally', kind: 'usage' }
}
await executeChatboxCliCommand({ argv: ['image','status', recordId] }, ctx)

Try / catch

const res = await executeChatboxCliCommand({ argv: ['image','status', id] }, ctx)
if (!res.ok && res.kind === 'usage' && res.error.startsWith('Image generation record not found')) {
  // re-list history and prompt the user to pick a current record
}

Prevention

When it happens

Trigger: A record id that was deleted, never existed, belongs to another device/account, or is mistyped. Also possible after history eviction or a storage reset.

Common situations: Stale ids from a cleared history, cross-device lookup where the record is absent locally, post-migration id changes, or copy/paste typos.

Related errors


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