{"record":{"id":"6547784c16c7bbae","repo":"paperclipai/paperclip","slug":"the-server-no-longer-reports-this-import-job-it","errorCode":null,"errorMessage":"The server no longer reports this import job — it may have restarted while the import ran.","messagePattern":"The server no longer reports this import job — it may have restarted while the import ran\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ui/src/pages/CompanyImport.tsx","lineNumber":797,"sourceCode":"async function watchImportJob(\n  jobId: string,\n  storageKey: string,\n): Promise<CompanyImportWatchOutcome> {\n  for (;;) {\n    let job: Awaited<ReturnType<typeof companiesApi.getImportJob>>[\"job\"] | null = null;\n    try {\n      job = (await companiesApi.getImportJob(jobId)).job;\n    } catch (err) {\n      if (err instanceof ApiError && err.status === 404) {\n        // The server has no record of this job. The retention sweep only drops\n        // jobs that have already *settled* (a running job is never removed), so\n        // a 404 while we are still watching means the in-memory record was lost\n        // to a restart mid-import — the import never reached a confirmed\n        // `succeeded` state and may not have finished. Report that honestly\n        // rather than masking a possibly-incomplete import as a success; the\n        // refreshed company list lets the user confirm what actually landed.\n        clearStoredImportJob(storageKey);\n        throw new Error(\n          \"The server no longer reports this import job — it may have restarted while the import ran.\",\n        );\n      }\n      if (\n        err instanceof ApiError\n        && err.status >= 400\n        && err.status < 500\n        && err.status !== 429\n      ) {\n        // A permanent client error (an expired board session, lost board\n        // access, or a bad request) will never recover by polling again, so\n        // stop instead of leaving the import locked in its running state.\n        // 429 (rate limited) and 5xx stay transient and fall through below.\n        clearStoredImportJob(storageKey);\n        throw new Error(\n          \"The import status can no longer be read — your session may have expired. Reload and sign in to check on it.\",\n        );\n      }","sourceCodeStart":779,"sourceCodeEnd":815,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/ui/src/pages/CompanyImport.tsx#L779-L815","documentation":"Watch-loop termination in watchImportJob: polling companiesApi.getImportJob returned 404 for a job that was still running when the watch started. Because the server's retention sweep never removes a running job, a 404 means the in-memory job record was lost (server restart), so the watcher clears the stored job id and fails loudly rather than masking a possibly incomplete import as success.","triggerScenarios":"Thrown at ui/src/pages/CompanyImport.tsx:797 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the import completed by listing companies; re-run the import if it did not."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}