{"record":{"id":"24027326eaf2eac9","repo":"paperclipai/paperclip","slug":"sandbox-namespace-name-is-terminating-cann","errorCode":null,"errorMessage":"Sandbox ${namespace}/${name} is Terminating — cannot wait for Ready","messagePattern":"Sandbox (.+?)/(.+?) is Terminating — cannot wait for Ready","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/sandbox-providers/kubernetes/src/sandbox-cr-orchestrator.ts","lineNumber":291,"sourceCode":"    const failedCondition = conditions.find((c) => c.type === \"Failed\" || (c.type === \"Ready\" && c.status === \"False\" && typeof c.reason === \"string\" && /failed/i.test(c.reason)));\n    const phase = (status.phase as string) ?? \"\";\n\n    if (readyCondition?.status === \"True\" || phase === \"Ready\") {\n      return mapSandboxPhase(cr);\n    }\n    if (failedCondition?.status === \"True\" || phase === \"Failed\") {\n      const mapped = mapSandboxPhase(cr);\n      throw new Error(\n        `Sandbox ${namespace}/${name} failed: ${mapped.reason ?? (failedCondition?.reason as string) ?? \"unknown reason\"} — ${mapped.message ?? (failedCondition?.message as string) ?? \"\"}`,\n      );\n    }\n    if (phase === \"Terminating\") {\n      // A Sandbox being torn down will never transition to Ready. Polling\n      // until the deadline would burn the full timeoutMs (potentially\n      // 30+ minutes) before throwing a generic timeout. Fail fast instead\n      // so the caller can surface a clear \"the lease is being released\"\n      // error and decide whether to retry against a fresh Sandbox.\n      throw new Error(\n        `Sandbox ${namespace}/${name} is Terminating — cannot wait for Ready`,\n      );\n    }\n    // Pending — keep polling\n    await sleep(pollMs);\n  }\n\n  throw new SandboxCrTimeoutError(namespace, name, opts.timeoutMs);\n}\n\n/**\n * Sandbox CR-backed conformance to SandboxOrchestrator.\n *\n * waitForCompletion semantics change: for this backend, \"completion\" means\n * \"pod is up and Ready to exec into\" — NOT \"workload finished\". The actual\n * command execution and its completion is handled by execInPod().\n */\nexport const sandboxCrOrchestrator: SandboxOrchestrator = {","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/plugins/sandbox-providers/kubernetes/src/sandbox-cr-orchestrator.ts#L273-L309","documentation":"Error \"Sandbox ${namespace}/${name} is Terminating — cannot wait for Ready\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at packages/plugins/sandbox-providers/kubernetes/src/sandbox-cr-orchestrator.ts:291 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for deletion to finish and create a new sandbox; do not wait for Ready on a Terminating sandbox."],"exampleFix":null,"handlingStrategy":null,"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"}