{"record":{"id":"4f7ec5e0f22e6e48","repo":"openclaw/openclaw","slug":"crabbox-operation-lease-is-not-ready","errorCode":null,"errorMessage":"Crabbox operation lease is not ready","messagePattern":"Crabbox operation lease is not ready","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/crabbox/src/crabbox-worker-provider.ts","lineNumber":327,"sourceCode":"    result.termination === \"exit\" &&\n    (authoritativeLeaseAbsence(result, params.context.id) ||\n      alreadyStopped(result, params.context.id))\n  ) {\n    return;\n  }\n  throw crabboxCommandError(\"stop\", result);\n}\n\nconst isTerminalState = (state: string) => DESTROYED_STATES.has(state.toLowerCase());\nconst isUnusableProvisionState = (state: string) =>\n  UNUSABLE_PROVISION_STATES.has(state.toLowerCase());\n\nfunction leaseFromInspect(inspect: ParsedInspect, profile: CrabboxProfile): WorkerLease {\n  if (isTerminalState(inspect.state)) {\n    throw new WorkerProviderError(\"Crabbox operation lease is no longer active\");\n  }\n  if (inspect.ready !== true) {\n    throw new Error(\"Crabbox operation lease is not ready\");\n  }\n  if (!inspect.host || !inspect.sshUser || !inspect.sshPort || !inspect.sshKey) {\n    throw new WorkerProviderError(\n      \"Crabbox profile provider does not expose a complete SSH worker endpoint\",\n    );\n  }\n  if (!inspect.sshHostKey) {\n    throw new WorkerProviderError(\n      \"Crabbox inspect does not expose the SSH host key required by the worker provider contract\",\n    );\n  }\n  return {\n    leaseId: inspect.id,\n    ssh: {\n      host: inspect.host,\n      port: inspect.sshPort,\n      fallbackPorts: inspect.sshFallbackPorts,\n      user: inspect.sshUser,","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/crabbox/src/crabbox-worker-provider.ts#L309-L345","documentation":"Thrown by leaseFromInspect() when inspect.ready !== true. Even if the lease state is non-terminal, a lease that is not ready cannot guarantee SSH connectivity, so the provider refuses to return it to core bootstrap. This is a plain Error (not WorkerProviderError) because it represents a transient/pending condition rather than a permanent policy violation — and unlike WorkerProviderError it does not trigger lease cleanup at the provision call site.","triggerScenarios":"leaseFromInspect called with inspect.ready being undefined, false, or any non-true value. At provision this is normally guarded by waitForProvisionReady polling until ready===true, so this fires when leaseFromInspect is reached with ready !== true — typically a race or a caller bypassing the readiness wait. Triggered at crabbox-worker-provider.ts:326-328.","commonSituations":"waitForProvisionReady's loop exited because state became unusable (handled separately) but leaseFromInspect was still called; a direct call to leaseFromInspect skipping the readiness poll; inspect.ready regressed from true to false between the last poll and leaseFromInspect (SSH flap).","solutions":["Re-inspect: `crabbox inspect --provider <p> --id <id> --json | jq .ready` and confirm whether it flips to true shortly.","Ensure provision goes through waitForProvisionReady before lease materialization; do not short-circuit the readiness wait.","If ready never becomes true, check SSH service health on the worker and the provider's readiness probe.","Re-provision if the lease is stuck not-ready."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await provider.provision(profile, operationId);\n} catch (error) {\n  if (error instanceof Error && error.message.includes(\"lease is not ready\")) {\n    // transient — re-provision after confirming SSH service health on the worker\n  }\n  throw error;\n}","preventionTips":["Always go through waitForProvisionReady before materializing a lease; do not short-circuit the readiness poll.","Ensure the Crabbox provider's readiness probe reflects real SSH availability.","Investigate leases that flip ready->false as SSH flaps; these indicate provider/network instability."],"tags":["crabbox","worker-provider","lease-state","readiness","ssh","transient"],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}