chatboxai/chatbox · error · Error

The image record linked to this approved tool call no longer

Error message

The image record linked to this approved tool call no longer exists. Start a new request and ask the user to approve it again.

What it means

Plain Error thrown when a persisted execution exists for the approved tool-call (persistedExecutionValue) but platform.getImageGenerationStorage().getById(recordId) returns null. The image record that approval was bound to has been deleted, so the approval cannot be honored and the user must approve a fresh request.

Source

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

    modelId ??= selected?.modelId
  }
  if (!provider) throw new ChatboxCliUsageError('Missing --provider (or configure a Chatbox license).')
  if (!modelId) throw new ChatboxCliUsageError('Missing --model.')
  const signature = JSON.stringify({ prompt, provider, modelId, count, aspectRatio, dalleStyle })
  if (existing) {
    if (existing.signature !== signature) {
      throw new Error(`Tool call ${cacheKey} was reused with different image arguments.`)
    }
    return existing.promise
  }

  if (persistedExecutionValue !== null) {
    if (persistedExecutionValue.signature !== signature) {
      throw new Error(`Tool call ${cacheKey} was reused with different image arguments.`)
    }
    const persistedRecord = await platform.getImageGenerationStorage().getById(persistedExecutionValue.recordId)
    if (!persistedRecord) {
      throw new Error(
        'The image record linked to this approved tool call no longer exists. Start a new request and ask the user to approve it again.'
      )
    }
    return restoredExecutionResult(persistedRecord)
  }

  if (settings.providers?.[provider]?.excludedModels?.includes(modelId)) {
    throw new ChatboxCliUsageError(`Image model is disabled in settings: ${provider}/${modelId}`)
  }
  availableModels ??= await getAvailableImageModels(settings)
  if (!availableModels.some((model) => model.provider === provider && model.modelId === modelId)) {
    throw new ChatboxCliUsageError(
      `Image model is not available: ${provider}/${modelId}. Use "chatbox image models" to list available models.`
    )
  }

  if (!approvedRequest) {
    const licenseDetail = settings.licenseDetail

View on GitHub (pinned to 81571269ad)

Solutions

  1. Start a brand-new image request and ask the user to approve it again.
  2. Do not attempt to restore/replay a tool-call whose record may have been deleted; treat this error as terminal.
  3. If records are disappearing unexpectedly, audit image-generation storage retention/eviction settings.

Example fix

// before: replaying an approved tool-call after history purge
await generateImage(ctx) // throws

// after: start fresh
await requestAppActionApproval(newToolCallId, 'image.generate', ...)
await generateImage({ ...ctx, toolCallId: newToolCallId })
Defensive patterns

Strategy: try-catch

Validate before calling

// Best effort: confirm the record still exists before replaying an approved call.
const record = await platform.getImageGenerationStorage().getById(persistedExecutionValue.recordId)
if (!record) {
  // start a fresh request and re-request approval instead of replaying
}

Try / catch

try {
  await generateImage(ctx)
} catch (error) {
  if (error instanceof Error && error.message.includes('no longer exists')) {
    // terminal: start a new request and ask the user to approve again
  } else throw error
}

Prevention

When it happens

Trigger: The image-generation record was deleted (user cleared history, storage eviction, account reset) between approval and the replay/restore attempt; or a storage migration dropped the record.

Common situations: Re-running an approved tool-call after the user purged image history, cross-session restore after local-storage cleanup, or a bug that removed records out of band.

Related errors


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