{"record":{"id":"84393ddec479f8d7","repo":"stablyai/orca","slug":"review-file-has-expired-create-a-new-one-before-o","errorCode":null,"errorMessage":"review file has expired; create a new one before opening","messagePattern":"review file has expired; create a new one before opening","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/ipc/diagnostics.ts","lineNumber":136,"sourceCode":"  if (!pending.previewOpened) {\n    throw new Error('open the review file before sending')\n  }\n  // Why: the preview file is user-editable once opened in the OS. Upload only\n  // the redacted bytes main collected and retained before preview.\n  return { bundle: pending.bundle, payload: pending.bundle.payload }\n}\n\nfunction getPendingPreviewFilePath(bundleSubmissionId: unknown): string {\n  if (\n    typeof bundleSubmissionId !== 'string' ||\n    !/^[A-Za-z0-9_-]{16,64}$/.test(bundleSubmissionId)\n  ) {\n    throw new Error('bundleSubmissionId has invalid format')\n  }\n  prunePendingBundles()\n  const pending = pendingBundles.get(bundleSubmissionId)\n  if (!pending) {\n    throw new Error('review file has expired; create a new one before opening')\n  }\n  return pending.previewFilePath\n}\n\nfunction discardPendingBundle(bundleSubmissionId: unknown): void {\n  if (\n    typeof bundleSubmissionId !== 'string' ||\n    !/^[A-Za-z0-9_-]{16,64}$/.test(bundleSubmissionId)\n  ) {\n    throw new Error('bundleSubmissionId has invalid format')\n  }\n  deletePendingBundle(bundleSubmissionId)\n}\n\nfunction deletePendingBundle(bundleSubmissionId: string): void {\n  const pending = pendingBundles.get(bundleSubmissionId)\n  if (pending) {\n    clearTimeout(pending.ttlTimer)","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/diagnostics.ts#L118-L154","documentation":"Thrown by getPendingPreviewFilePath when bundleSubmissionId is well-formed but absent from the pendingBundles map after pruning. Identical lifecycle cause as 1097 but on the open-preview path: the pending entry expired or was cleared between bundle creation and the open attempt.","triggerScenarios":"Calling the open-preview IPC with a bundleSubmissionId whose pending entry was pruned (TTL elapsed) or lost to an app restart. The format regex passed but the map lookup missed.","commonSituations":"App restarted after creating the bundle; user waited beyond the bundle TTL before opening the preview; bundle pruned under memory pressure; stale ID from a prior session.","solutions":["Create a new review/diagnostics bundle to obtain a fresh bundleSubmissionId, then open the preview.","Open the preview soon after creation, within the same session and TTL window.","If restarts are common, persist bundle metadata so previews survive relaunch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function hasPendingPreview(id: string): boolean {\n  prunePendingBundles()\n  return pendingBundles.has(id)\n}","typeGuard":"function isPendingBundleFresh(id: string, map: Map<string, unknown>): boolean {\n  return map.has(id)\n}","tryCatchPattern":"try {\n  return getPendingPreviewFilePath(id)\n} catch (error) {\n  if (error instanceof Error && /expired; create a new one/.test(error.message)) {\n    const fresh = await createReviewBundle(...)\n    return getPendingPreviewFilePath(fresh.bundleSubmissionId)\n  }\n  throw error\n}","preventionTips":["Open the review preview in the same session that created the bundle.","Open within the bundle TTL window before pruning reaps the entry.","Regenerate bundles after any app restart."],"tags":["diagnostics","review-file","ipc","state","expiry"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}