openclaw/openclaw · error · WorkerProviderError

Crabbox inspect returned invalid output

Error message

Crabbox inspect returned invalid output

What it means

Thrown by inspectWithContext() as the fallback message when parseInspectJson rejects with a non-Error value. In practice parseInspectJson always throws Error instances (with specific messages like "invalid JSON", "invalid lease identity or state", or the field-specific errors 1280-1284), so this exact message is the catch-all for the rare case where the parser throws a non-Error. The actual surfaced message is usually the inner error's message.

Source

Thrown at extensions/crabbox/src/crabbox-worker-provider.ts:270

      params.context.provider,
      "--network",
      "public",
      "--id",
      params.id,
      "--json",
    ],
    binary: params.context.binary,
    runCommand: params.runCommand,
    timeoutMs: params.timeoutMs ?? CRABBOX_LIFECYCLE_TIMEOUT_MS,
  });
  if (result.termination === "exit" && result.code === 0) {
    // A successful but malformed response cannot attest the fixed lease. Command failures and
    // authoritative absence remain transient so Gateway replay can inspect the live lease later.
    let inspect: ParsedInspect;
    try {
      inspect = parseInspectJson(result.stdout);
    } catch (error) {
      throw new WorkerProviderError(
        error instanceof Error ? error.message : "Crabbox inspect returned invalid output",
      );
    }
    if (params.expectedLeaseId && inspect.id !== params.expectedLeaseId) {
      throw new WorkerProviderError("Crabbox inspect returned a different lease id");
    }
    return { status: "found", inspect };
  }
  if (result.termination === "exit" && authoritativeLeaseAbsence(result, params.id)) {
    return { status: "unknown" };
  }
  throw crabboxCommandError("inspect", result);
}

function remainingProvisionTimeout(deadline: number, maximum: number): number {
  const remaining = deadline - Date.now();
  if (remaining <= 0) {
    throw new Error("Crabbox provision exceeded its provider deadline");

View on GitHub (pinned to 01804a7531)

Solutions

  1. Read the actual error message — this fallback is the catch-all; the real cause is in the inner error message that surfaces in the thrown WorkerProviderError.
  2. Re-run `crabbox inspect --provider <p> --id <id> --json` and validate the JSON shape against ParsedInspect.
  3. If you see this exact string with no inner detail, inspect parseInspectJson for a non-Error throw path.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await provider.provision(profile, operationId);
} catch (error) {
  if (error instanceof WorkerProviderError && /Crabbox inspect returned/.test(error.message)) {
    // inspect output failed validation — re-run `crabbox inspect --json` and check the shape
  }
  throw error;
}

Prevention

When it happens

Trigger: inspectWithContext runs `crabbox inspect` successfully (exit 0), then parseInspectJson(result.stdout) throws something that is not an instanceof Error — only then does the fallback "Crabbox inspect returned invalid output" fire at crabbox-worker-provider.ts:270-272. Real malformed output surfaces the inner Error's message instead.

Common situations: Effectively unreachable because parseInspectJson throws `new Error(...)` exclusively. Could only fire if a future edit to parseInspectJson throws a non-Error (e.g. a string throw), or if a monkeypatch replaces the parser. The user-visible message for genuinely malformed inspect JSON is one of the parser's specific messages (errors 1280-1284 or "invalid JSON").

Related errors


AI-assisted analysis of openclaw/openclaw@01804a7531 (2026-08-12). Data as JSON: /api/errors/b618033824f671b4. Report an issue: GitHub.