chatboxai/chatbox · warning · Error

Record not found

Error message

Record not found

What it means

Thrown by resumeGeneration when platform.getImageGenerationStorage().getById(recordId) returns null. The persistent image-generation record store could not find the id passed in, so there is nothing to resume.

Source

Thrown at src/renderer/stores/imageGenerationActions.ts:449

    imageGenerationStore.getState().setCurrentRecordId(record.id)
  }
  return record
}

export function clearCurrentRecord(): void {
  imageGenerationStore.getState().setCurrentRecordId(null)
}

export async function resumeGeneration(recordId: string): Promise<ImageGeneration | null> {
  const store = imageGenerationStore.getState()

  if (store.currentGeneratingId !== null) {
    throw new Error('Another image is being generated. Please wait.')
  }

  const record = await platform.getImageGenerationStorage().getById(recordId)
  if (!record) {
    throw new Error('Record not found')
  }

  if (!record.taskId) {
    throw new Error('No task ID found for this record')
  }

  const licenseKey = getLicenseKey()
  store.setCurrentGeneratingId(recordId)

  // Create AbortController for resume operation
  currentAbortController = new AbortController()
  const signal = currentAbortController.signal

  try {
    // Check current status, then poll if not finished
    const currentStatus = await pollImageTask(record.taskId, licenseKey, signal)

    let finalResult = currentStatus

View on GitHub (pinned to 81571269ad)

Solutions

  1. Remove the UI card when its underlying record is deleted; refresh the list query on resume error.
  2. Invalidate stale recordIds held in component state when queryClient refetches IMAGE_GEN_LIST_QUERY_KEY.
  3. Return null instead of throwing for a missing record so the caller can silently dismiss.
  4. Guard the caller: verify the recordId still exists in the cached list before calling resumeGeneration.

Example fix

// before
const record = await platform.getImageGenerationStorage().getById(recordId)
if (!record) throw new Error('Record not found')
// after
const record = await platform.getImageGenerationStorage().getById(recordId)
if (!record) {
  log.warn('resumeGeneration: record vanished', recordId)
  queryClient.invalidateQueries({ queryKey: [IMAGE_GEN_LIST_QUERY_KEY] })
  return null
}
Defensive patterns

Strategy: validation

Validate before calling

const record = await platform.getImageGenerationStorage().getById(recordId)
if (!record) {
  queryClient.invalidateQueries({ queryKey: [IMAGE_GEN_LIST_QUERY_KEY] })
  return null
}

Type guard

function recordExists<T>(r: T | null | undefined): r is T {
  return r != null
}

Prevention

When it happens

Trigger: A resume call references a recordId that no longer exists in storage: the record was deleted by the user/history cleanup, the id is stale (from a closed tab), or storage was wiped (cache clear, logout). Also possible after a schema migration that dropped old records.

Common situations: User deletes an image record then clicks resume on a stale UI card, app cache cleared, logout cleared local storage, or a recordId passed from a deep link that never existed.

Related errors


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