{"record":{"id":"7b1a84ce2b939519","repo":"paperclipai/paperclip","slug":"paperclip-execution-mode-and-the-paperclip-managed","errorCode":null,"errorMessage":"PAPERCLIP_EXECUTION_MODE and the PAPERCLIP_MANAGED_CONFIG \"environments\" section are mutually exclusive: both manage the single instance sandbox environment","messagePattern":"PAPERCLIP_EXECUTION_MODE and the PAPERCLIP_MANAGED_CONFIG \"environments\" section are mutually exclusive: both manage the single instance sandbox environment","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/managed-environments.ts","lineNumber":187,"sourceCode":"        );\n      }\n    } catch (err) {\n      logger.error(\n        { err },\n        \"failed to revert the stamped managed sandbox instance default (degraded: stale default until the next boot)\",\n      );\n    }\n  }\n\n  if (managedConfig.environments.length === 0) return null;\n\n  // The forced-execution-mode bootstrap (`PAPERCLIP_EXECUTION_MODE=kubernetes`)\n  // and this one both own the single Paperclip-managed sandbox row\n  // (`environments_managed_sandbox_idx`). Configuring both is contradictory;\n  // refuse startup rather than let bootstrap ordering pick a winner.\n  const env = opts.env ?? process.env;\n  if (parseExecutionPolicyBootstrapEnv(env)) {\n    throw new Error(\n      `PAPERCLIP_EXECUTION_MODE and the PAPERCLIP_MANAGED_CONFIG \"environments\" section are mutually exclusive: both manage the single instance sandbox environment`,\n    );\n  }\n\n  // The heartbeat resumes queued runs right after this bootstrap step, and\n  // lease acquisition fails hard on a provider whose plugin is missing or not\n  // ready. Wait for the bundled-plugin startup pass to finish, then refuse to\n  // ensure (and in particular to re-activate) a row whose provider driver did\n  // not come up — a degraded boot without the row beats an active environment\n  // that fails every lease until the plugin recovers.\n  await opts.pluginsReady;\n\n  const resolveDriver = opts.resolveSandboxProviderDriver ?? resolvePluginSandboxProviderDriverByKey;\n\n  /**\n   * Point the instance default at the managed sandbox row when no\n   * deliberate choice stands in the way: an unset default, a default on\n   * the (hidden-under-this-mode) local row, or a dangling reference all","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/managed-environments.ts#L169-L205","documentation":"Mutual-exclusion guard in applyManagedEnvironments: both PAPERCLIP_EXECUTION_MODE=kubernetes bootstrap and a managed-config 'environments' section are configured. Both claim ownership of the single managed sandbox environment row; startup refuses rather than letting bootstrap ordering pick a winner.","triggerScenarios":"Thrown at server/src/services/managed-environments.ts:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use either PAPERCLIP_EXECUTION_MODE or the PAPERCLIP_MANAGED_CONFIG \"environments\" section, not both."],"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-14T00:17:10.932Z"}