{"record":{"id":"fcd07b40969ff0e4","repo":"Yeachan-Heo/oh-my-codex","slug":"command-exited-with-code-result-status","errorCode":null,"errorMessage":"Command exited with code ${result.status}","messagePattern":"Command exited with code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/openclaw/dispatcher.ts","lineNumber":260,"sourceCode":"      return { gateway: gatewayName, success: false, error: \"Command is empty\" };\n    }\n\n    const result = await runProcessTreeWithTimeout(\n      commandParts.command,\n      commandParts.args,\n      {\n        timeoutMs: timeout,\n        env: { ...process.env },\n        cleanupOnParentExit: true,\n      },\n    );\n\n    if (result.error) throw result.error;\n    if (result.timedOut) throw new Error(\"Command timed out\");\n    if (result.outputLimitExceeded) throw new Error(\"Command output limit exceeded\");\n    if (result.processLimitExceeded) throw new Error(\"Command process limit exceeded\");\n    if (result.signal) throw new Error(`Command killed by signal ${result.signal}`);\n    if (result.status !== 0) throw new Error(`Command exited with code ${result.status}`);\n\n    return { gateway: gatewayName, success: true };\n  } catch (error) {\n    return {\n      gateway: gatewayName,\n      success: false,\n      error: error instanceof Error ? error.message : \"Unknown error\",\n    };\n  }\n}\n","sourceCodeStart":242,"sourceCodeEnd":271,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/openclaw/dispatcher.ts#L242-L271","documentation":"The wake subprocess completed but exited with a non-zero status code; the dispatcher reports the exact exit code for diagnosis.","triggerScenarios":"The gateway command itself fails: missing binary (127), bad arguments, missing dependency (1), or permission denied (126).","commonSituations":"See trigger scenarios.","solutions":["Run the exact wake command manually to reproduce the failure","Check exit code semantics: 127 = command not found, 126 = not executable, 1 = generic app error","Fix environment: PATH, dependencies, file permissions","Handle the returned success:false result and surface stderr from the wake output"],"exampleFix":"# before (binary missing)\n$ omx-claw-gateway wake   # exit 127\n# after\n$ npm i -g omx-claw-gateway && omx openclaw wake","handlingStrategy":"try-catch","validationCode":"const exists = await new Promise(res => spawn(cmd, ['--version']).on('exit', c => res(c === 0)));","typeGuard":null,"tryCatchPattern":"const r = await wakeOpenClaw(...); if (!r.success && /exited with code/.test(r.error ?? '')) { logWakeDiagnostics(); /* run command manually, fix env */ }","preventionTips":["Smoke-test gateway commands manually before automating","Pin tool versions so dependency drift doesn't break exit codes"],"tags":["exit-code","subprocess","openclaw"],"backgroundTag":"non-zero-exit-code","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}