{"record":{"id":"04facc57f49cf97e","repo":"paperclipai/paperclip","slug":"environment-not-found","errorCode":"environment_not_found","errorMessage":"Environment \"${environmentId}\" not found.","messagePattern":"Environment \"(.+?)\" not found\\.","errorType":"exception","errorClass":"EnvironmentRunError","httpStatus":null,"severity":"error","filePath":"server/src/services/environment-run-orchestrator.ts","lineNumber":182,"sourceCode":"  /**\n   * Resolve the selected environment for a run. The caller passes the concrete\n   * selected environment id plus the built-in local fallback id used to lazily\n   * ensure the local environment row exists.\n   */\n  async function resolveEnvironment(input: {\n    companyId: string;\n    selectedEnvironmentId: string;\n    localEnvironmentId: string;\n  }): Promise<Environment> {\n    const environmentId = input.selectedEnvironmentId || input.localEnvironmentId;\n\n    const environment =\n      environmentId === input.localEnvironmentId\n        ? await environmentsSvc.ensureLocalEnvironment(input.companyId)\n        : await environmentsSvc.getById(environmentId);\n\n    if (!environment) {\n      throw new EnvironmentRunError(\"environment_not_found\", `Environment \"${environmentId}\" not found.`, {\n        environmentId,\n      });\n    }\n\n    if (environment.status !== \"active\") {\n      throw new EnvironmentRunError(\"environment_inactive\", `Environment \"${environment.name}\" is not active (status: ${environment.status}).`, {\n        environmentId: environment.id,\n        driver: environment.driver,\n      });\n    }\n\n    return environment;\n  }\n\n  /**\n   * Acquire an environment lease for a heartbeat run.\n   * Wraps the runtime driver's acquire call with standardized error handling.\n   */","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/environment-run-orchestrator.ts#L164-L200","documentation":"EnvironmentRunError('environment_not_found') from resolveEnvironment: the selected environment id does not match the local fallback and environmentsSvc.getById returned no row. The run cannot proceed against a nonexistent environment; environmentId is attached to the error.","triggerScenarios":"Thrown at server/src/services/environment-run-orchestrator.ts:182 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the environment id exists for the company; create the environment first if needed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}