Yeachan-Heo/oh-my-codex · error · Error

Command exited with code ${result.status}

Error message

Command exited with code ${result.status}

What it means

The wake subprocess completed but exited with a non-zero status code; the dispatcher reports the exact exit code for diagnosis.

Source

Thrown at src/openclaw/dispatcher.ts:260

      return { gateway: gatewayName, success: false, error: "Command is empty" };
    }

    const result = await runProcessTreeWithTimeout(
      commandParts.command,
      commandParts.args,
      {
        timeoutMs: timeout,
        env: { ...process.env },
        cleanupOnParentExit: true,
      },
    );

    if (result.error) throw result.error;
    if (result.timedOut) throw new Error("Command timed out");
    if (result.outputLimitExceeded) throw new Error("Command output limit exceeded");
    if (result.processLimitExceeded) throw new Error("Command process limit exceeded");
    if (result.signal) throw new Error(`Command killed by signal ${result.signal}`);
    if (result.status !== 0) throw new Error(`Command exited with code ${result.status}`);

    return { gateway: gatewayName, success: true };
  } catch (error) {
    return {
      gateway: gatewayName,
      success: false,
      error: error instanceof Error ? error.message : "Unknown error",
    };
  }
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Run the exact wake command manually to reproduce the failure
  2. Check exit code semantics: 127 = command not found, 126 = not executable, 1 = generic app error
  3. Fix environment: PATH, dependencies, file permissions
  4. Handle the returned success:false result and surface stderr from the wake output

Example fix

# before (binary missing)
$ omx-claw-gateway wake   # exit 127
# after
$ npm i -g omx-claw-gateway && omx openclaw wake
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = await new Promise(res => spawn(cmd, ['--version']).on('exit', c => res(c === 0)));

Try / catch

const r = await wakeOpenClaw(...); if (!r.success && /exited with code/.test(r.error ?? '')) { logWakeDiagnostics(); /* run command manually, fix env */ }

Prevention

When it happens

Trigger: The gateway command itself fails: missing binary (127), bad arguments, missing dependency (1), or permission denied (126).

Common situations: See trigger scenarios.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/fcd07b40969ff0e4. Report an issue: GitHub.