{"record":{"id":"768a5059e6660907","repo":"paperclipai/paperclip","slug":"daytona-sandbox-sandbox-id-is-in-an-unrecoverab","errorCode":null,"errorMessage":"Daytona sandbox ${sandbox.id} is in an unrecoverable error state: ${sandbox.errorReason ?? \"unknown error\"}","messagePattern":"Daytona sandbox (.+?) is in an unrecoverable error state: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/plugins/sandbox-providers/daytona/src/plugin.ts","lineNumber":378,"sourceCode":"}\n\nfunction isValidUrl(value: string): boolean {\n  try {\n    new URL(value);\n    return true;\n  } catch {\n    return false;\n  }\n}\n\nasync function ensureSandboxStarted(sandbox: Sandbox, timeoutSeconds: number): Promise<void> {\n  if (sandbox.state === \"started\") return;\n  if (sandbox.state === \"error\") {\n    if (sandbox.recoverable) {\n      await sandbox.recover(timeoutSeconds);\n      return;\n    }\n    throw new Error(`Daytona sandbox ${sandbox.id} is in an unrecoverable error state: ${sandbox.errorReason ?? \"unknown error\"}`);\n  }\n  await sandbox.start(timeoutSeconds);\n}\n\nasync function resolveSandboxWorkingDirectory(sandbox: Sandbox): Promise<string> {\n  const root = (await sandbox.getWorkDir())?.trim()\n    || (await sandbox.getUserHomeDir())?.trim()\n    || \"/home/daytona\";\n  const remoteCwd = path.posix.join(root, \"paperclip-workspace\");\n  await sandbox.fs.createFolder(remoteCwd, \"755\");\n  return remoteCwd;\n}\n\nasync function detectSandboxShellCommand(sandbox: Sandbox, timeoutSeconds: number): Promise<\"bash\" | \"sh\"> {\n  try {\n    const result = await sandbox.process.executeCommand(\n      \"if command -v bash >/dev/null 2>&1; then printf bash; else printf sh; fi\",\n      undefined,","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/sandbox-providers/daytona/src/plugin.ts#L360-L396","documentation":"Thrown by ensureSandboxStarted when a sandbox is in the 'error' state and its recoverable flag is false, meaning the Daytona sandbox suffered an unrecoverable failure and cannot be restarted. The errorReason (or 'unknown error') from the sandbox is included.","triggerScenarios":"ensureSandboxStarted is called for a sandbox whose state is 'error' and sandbox.recoverable is false. This occurs before any exec/sync that needs a started sandbox.","commonSituations":"The Daytona sandbox hit a fatal infrastructure error (image corruption, node loss, quota exhaustion, snapshot invalid); a previous recover attempt failed and flipped recoverable to false; long-idle sandbox that degraded past recovery; misconfigured image/snapshot that cannot boot.","solutions":["Read sandbox.errorReason in the message to diagnose the underlying failure.","Release the current lease and acquire a new sandbox (the unrecoverable one cannot be saved).","If the image/snapshot is at fault, fix the template and recapture before re-acquiring.","Check Daytona account quotas/limits that may have put the sandbox in an error state."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await ensureSandboxStarted(sandbox, timeoutSeconds);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('unrecoverable error state')) {\n    // release lease; acquire a new sandbox; do not retry on the same handle\n  }\n  throw e;\n}","preventionTips":["Monitor sandbox state and release error-state, non-recoverable sandboxes promptly.","Fix image/snapshot templates that produce boot failures to avoid unrecoverable states.","Treat this error as terminal for the lease; acquire a new one."],"tags":["daytona","sandbox","lifecycle","unrecoverable","infrastructure"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}