{"record":{"id":"a4ea960eaa90bbe6","repo":"paperclipai/paperclip","slug":"import-transfer-expired-re-create-it","errorCode":null,"errorMessage":"Import transfer expired — re-create it","messagePattern":"Import transfer expired — re-create it","errorType":"http","errorClass":null,"httpStatus":410,"severity":"error","filePath":"server/src/routes/companies.ts","lineNumber":911,"sourceCode":"        // deleted out from under it; a swept or failed run is dead, so the\n        // stray part is dropped and the client told to re-create.\n        const current = await companyTransferRunService.getRun(db, run.id);\n        if (current?.status === \"applying\" || current?.status === \"completed\") {\n          throw conflict(\"Import transfer apply is in progress; retry after it settles\");\n        }\n        await removeImportTransferPart(importTransferSpoolRoot, run.id, partIndex);\n        res.status(410).json({ error: \"Import transfer expired — re-create it\" });\n        return;\n      }\n      res.json({ ok: true, index: partIndex, alreadyCompleted: false } satisfies CompanyImportTransferPartUploadResult);\n    },\n  );\n\n  // Resume polling: which parts are done, which are still missing.\n  router.get(`${COMPANY_IMPORT_TRANSFERS_ROUTE_PATH}/:transferId`, async (req, res) => {\n    assertBoard(req);\n    const run = await requireImportTransferRun(req);\n    const manifest = storedImportTransferManifest(run);\n    const missingParts = run.status === \"completed\" ? [] : await importTransferMissingParts(run, manifest);\n    res.json({\n      transferId: run.id,\n      status: run.status,\n      totalParts: manifest.parts.length,\n      completedParts: manifest.parts.length - missingParts.length,\n      missingParts,\n    } satisfies CompanyImportTransferStatus);\n  });\n\n  /**\n   * Resolve a completed transfer into the same raw preview/import body a\n   * single-shot zip upload produces: load the run, require every part, then\n   * assemble the spool and verify it against the declared whole-file hash.\n   * Shared by the transfer preview and apply routes; returns null after\n   * responding 409 when parts are still missing. A whole-file mismatch fails\n   * closed for both callers: every part verified individually but the whole\n   * does not match the declaration, so the spool is deleted and a resume","sourceCodeStart":893,"sourceCodeEnd":929,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/companies.ts#L893-L929","documentation":"Transfer-state guard in resolveImportTransferBody: the chunked import transfer run is expired (the abandoned-spool sweep or TTL ended it), so its uploaded parts are gone and preview/apply cannot proceed; the client must re-create the transfer and re-upload.","triggerScenarios":"Thrown at server/src/routes/companies.ts:878 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the conflicting state to clear (running job, hold, pause, or stale fingerprint), refresh the current state, then retry the operation."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}