{"record":{"id":"9664c9841d0f056e","repo":"stablyai/orca","slug":"commandlabel-args-join-failed-to-start","errorCode":null,"errorMessage":"${commandLabel} ${args.join(' ')} failed to start: ${String(result.error)}","messagePattern":"(.+?) (.+?) failed to start: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/live-remote-freeze-rpc.mjs","lineNumber":92,"sourceCode":"  const commandLabel = cliCommand ?? resolveOrcaCliCommand({ env, platform })\n  const commandArgs = (args, local) => [\n    ...cliInvocation.prefixArgs,\n    ...args,\n    ...(local ? [] : ['--environment', envName]),\n    '--json'\n  ]\n\n  function orcaJsonSync(args, opts = {}) {\n    const started = performance.now()\n    const result = spawnSync(cliInvocation.command, commandArgs(args, opts.local), {\n      encoding: 'utf8',\n      env: cliInvocation.env,\n      maxBuffer: MAX_ORCA_RPC_OUTPUT_BYTES,\n      timeout: opts.timeoutMs ?? 120_000\n    })\n    const elapsedMs = performance.now() - started\n    if (result.error) {\n      throw new Error(`${commandLabel} ${args.join(' ')} failed to start: ${String(result.error)}`)\n    }\n    if (result.status !== 0) {\n      throw new Error(\n        `${commandLabel} ${args.join(' ')} failed (${result.status}): ${result.stderr || result.stdout}`\n      )\n    }\n    const parsed = JSON.parse(result.stdout)\n    if (parsed.ok === false) {\n      throw new Error(`${commandLabel} ${args.join(' ')} ok=false: ${JSON.stringify(parsed)}`)\n    }\n    return { parsed, elapsedMs, result: parsed.result }\n  }\n\n  function orcaJsonAsync(args, opts = {}) {\n    const started = performance.now()\n    return new Promise((resolve, reject) => {\n      const child = spawn(cliInvocation.command, commandArgs(args, opts.local), {\n        env: cliInvocation.env,","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/live-remote-freeze-rpc.mjs#L74-L110","documentation":"orcaJsonSync spawns the orca CLI via spawnSync and inspects result.error, which Node sets when the child could not be spawned at all (ENOENT, EACCES, bad executable path). This throw fires before any exit code or stdout is available because the process never ran. It is the 'binary unreachable' failure mode distinct from a non-zero exit (105) or an RPC-level ok=false (106).","triggerScenarios":"cliInvocation.command points at an orca binary that does not exist at that path, lacks the executable bit, is the wrong platform/architecture, or the spawn env (cliInvocation.env) is missing PATH entries needed to locate it.","commonSituations":"Running the script on a machine without orca installed or built, a stale cliInvocation resolved from a moved install directory, an SSH/remote target where the binary path is relative to the wrong cwd, or a packaging issue where the binary was not bundled.","solutions":["Confirm the binary exists and is executable: test -x \"$(command -v orca)\" or check cliInvocation.command directly.","Print cliInvocation.command and cliInvocation.env.PATH to verify the spawn target and search path.","Reinstall/rebuild orca so the path the script resolves matches an on-disk executable.","If running remotely over SSH, ensure the binary is on PATH on the remote host, not just locally."],"exampleFix":"// before\nconst result = spawnSync(cliInvocation.command, args, { env: cliInvocation.env })\nif (result.error) throw new Error(`${commandLabel} ... failed to start: ${result.error}`)\n\n// after\nconst { existsSync } = require('node:fs')\nif (!cliInvocation.command || !existsSync(cliInvocation.command.split(' ')[0])) {\n  throw new Error(`orca binary not found at ${cliInvocation.command}`)\n}\nconst result = spawnSync(cliInvocation.command, args, { env: cliInvocation.env })\nif (result.error) throw new Error(`${commandLabel} ... failed to start: ${result.error}`)","handlingStrategy":"validation","validationCode":"const { existsSync } = require('node:fs')\nconst bin = cliInvocation.command\nif (!bin || !(existsSync(bin) || which.sync(bin, { nothrow: true }))) {\n  throw new Error(`orca binary not resolvable: ${bin}`)\n}","typeGuard":"const isExecutableTarget = (c) => typeof c === 'string' && c.length > 0","tryCatchPattern":"try {\n  return orcaJsonSync(args)\n} catch (e) {\n  if (/failed to start/.test(e.message)) { await ensureOrcaInstalled(); return orcaJsonSync(args) }\n  throw e\n}","preventionTips":["Resolve the orca binary path once at startup and validate it is executable.","Keep cliInvocation.env.PATH aligned with the install location.","In remote/SSH runs, verify the binary is on PATH on the remote host."],"tags":["spawn","process","enoent","rpc","cli"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}