{"record":{"id":"5a8aaff9b65d6b58","repo":"chatboxai/chatbox","slug":"record-not-found","errorCode":null,"errorMessage":"Record not found","messagePattern":"Record not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/renderer/stores/imageGenerationActions.ts","lineNumber":449,"sourceCode":"    imageGenerationStore.getState().setCurrentRecordId(record.id)\n  }\n  return record\n}\n\nexport function clearCurrentRecord(): void {\n  imageGenerationStore.getState().setCurrentRecordId(null)\n}\n\nexport async function resumeGeneration(recordId: string): Promise<ImageGeneration | null> {\n  const store = imageGenerationStore.getState()\n\n  if (store.currentGeneratingId !== null) {\n    throw new Error('Another image is being generated. Please wait.')\n  }\n\n  const record = await platform.getImageGenerationStorage().getById(recordId)\n  if (!record) {\n    throw new Error('Record not found')\n  }\n\n  if (!record.taskId) {\n    throw new Error('No task ID found for this record')\n  }\n\n  const licenseKey = getLicenseKey()\n  store.setCurrentGeneratingId(recordId)\n\n  // Create AbortController for resume operation\n  currentAbortController = new AbortController()\n  const signal = currentAbortController.signal\n\n  try {\n    // Check current status, then poll if not finished\n    const currentStatus = await pollImageTask(record.taskId, licenseKey, signal)\n\n    let finalResult = currentStatus","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/stores/imageGenerationActions.ts#L431-L467","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the UI card when its underlying record is deleted; refresh the list query on resume error.","Invalidate stale recordIds held in component state when queryClient refetches IMAGE_GEN_LIST_QUERY_KEY.","Return null instead of throwing for a missing record so the caller can silently dismiss.","Guard the caller: verify the recordId still exists in the cached list before calling resumeGeneration."],"exampleFix":"// before\nconst record = await platform.getImageGenerationStorage().getById(recordId)\nif (!record) throw new Error('Record not found')\n// after\nconst record = await platform.getImageGenerationStorage().getById(recordId)\nif (!record) {\n  log.warn('resumeGeneration: record vanished', recordId)\n  queryClient.invalidateQueries({ queryKey: [IMAGE_GEN_LIST_QUERY_KEY] })\n  return null\n}","handlingStrategy":"validation","validationCode":"const record = await platform.getImageGenerationStorage().getById(recordId)\nif (!record) {\n  queryClient.invalidateQueries({ queryKey: [IMAGE_GEN_LIST_QUERY_KEY] })\n  return null\n}","typeGuard":"function recordExists<T>(r: T | null | undefined): r is T {\n  return r != null\n}","tryCatchPattern":null,"preventionTips":["Refresh the list query when a record is deleted so stale ids are pruned.","Verify the recordId still exists in the cached list before calling resumeGeneration.","Return null instead of throwing for a vanished record."],"tags":["image-generation","storage","resume","stale-state"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}