{"record":{"id":"6a548ea99b579dbe","repo":"paperclipai/paperclip","slug":"environment-lease-not-found","errorCode":null,"errorMessage":"Environment lease not found","messagePattern":"Environment lease not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/src/routes/environments.ts","lineNumber":1105,"sourceCode":"    assertCanAccessInstanceEnvironments(req);\n    const environment = await svc.getById(req.params.id as string);\n    if (!environment) {\n      res.status(404).json({ error: \"Environment not found\" });\n      return;\n    }\n    // Metadata only (name / status / owning company) — never secret values.\n    // Environments are instance-scoped while secrets are company-scoped, so\n    // the editor needs this to render refs whose secret a given company's\n    // picker cannot list. Gated by the same instance-level access check as\n    // environment editing.\n    const refs = await collectEnvironmentSecretRefs({ db, environment });\n    res.json({ refs: await secrets.describeSecretRefs(refs) });\n  });\n\n  router.get(\"/environments/:id/leases\", async (req, res) => {\n    assertCanReadInstanceEnvironments(req);\n    const environment = await svc.getById(req.params.id as string);\n    if (!environment) {\n      res.status(404).json({ error: \"Environment not found\" });\n      return;\n    }\n    const leases = await svc.listLeases(environment.id, {\n      status: req.query.status as string | undefined,\n    });\n    res.json(leases);\n  });\n\n  router.get(\"/environment-leases/:leaseId\", async (req, res) => {\n    assertCanReadInstanceEnvironments(req);\n    const lease = await svc.getLeaseById(req.params.leaseId as string);\n    if (!lease) {\n      res.status(404).json({ error: \"Environment lease not found\" });\n      return;\n    }\n    res.json(lease);\n  });","sourceCodeStart":1087,"sourceCodeEnd":1123,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/environments.ts#L1087-L1123","documentation":"404 sentinel on the environment lease read routes: getLeaseById returned no row for the requested leaseId, so no such lease exists in the instance.","triggerScenarios":"Thrown at server/src/routes/environments.ts:1104 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-14T00:17:10.932Z"}