{"record":{"id":"d828fd871a0eba15","repo":"paperclipai/paperclip","slug":"environment-customimage-setup-session-not-found","errorCode":null,"errorMessage":"Environment customImage setup session not found","messagePattern":"Environment customImage setup session not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/src/routes/environments.ts","lineNumber":800,"sourceCode":"  router.post(\n    \"/environments/:environmentId/custom-image-setup-sessions\",\n    validate(startEnvironmentCustomImageSetupSessionSchema),\n    async (req, res) => {\n      assertCanAccessInstanceEnvironments(req);\n      const companyId = await resolveCustomImageCompanyId(req);\n      const actor = getActorInfo(req);\n      const result = await customImages.startSetupSession({\n        environmentId: req.params.environmentId as string,\n        templateId: req.body.templateId ?? null,\n        ttlSeconds: req.body.ttlSeconds ?? null,\n        actor: {\n          userId: actor.actorType === \"user\" ? actor.actorId : null,\n          agentId: actor.agentId,\n        },\n        secretContextCompanyId: companyId,\n      });\n      await logEnvironmentCustomImageActivity({\n        actor,\n        companyId,\n        action: \"environment.custom_image_setup.started\",\n        entityId: result.session.environmentId,\n        details: setupSessionActivityDetails(result.session),\n      });\n      res.status(201).json(result);\n    },\n  );\n\n  router.get(\"/environment-custom-image-setup-sessions/:sessionId\", async (req, res) => {\n    assertCanAccessInstanceEnvironments(req);\n    const session = await customImages.getSessionById(req.params.sessionId as string);\n    if (!session) {\n      res.status(404).json({ error: \"Environment customImage setup session not found\" });\n      return;\n    }\n    await resolveCustomImageSessionCompanyId(req, session);\n    const result = await customImages.refreshSetupSession({","sourceCodeStart":782,"sourceCodeEnd":818,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/environments.ts#L782-L818","documentation":"Lookup guard on the custom-image setup session route: the requested setup session id is unknown or already consumed/expired in the session store, so the guided custom-image setup cannot be continued and the route returns 404.","triggerScenarios":"Thrown at server/src/routes/environments.ts:799 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the id in the request path or body refers to an existing record in this company; re-list the parent collection to get a valid id.","Check that the record was not deleted or archived, and that the request is scoped to the correct companyId."],"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"}