affaan-m/ECC · error
failed
Error message
${command} ${args.join(' ')} failed: ${result.error.message} What it means
runCommand wraps spawnSync calls (typically to the gh CLI) and throws this when the spawned process itself failed to run — result.error is set. Unlike a non-zero exit status (handled separately), result.error means Node could not spawn or the process was killed (e.g. ENOENT, EACCES, signal termination).
Solutions
- Install the GitHub CLI (gh) and confirm `which gh` resolves it on PATH.
- Check execute permissions on the binary (chmod +x) if it exists locally.
- Run the same command manually to see the underlying spawn error; fix PATH/env passed via options.env.
- If ENOMEM/kills occur, reduce concurrency or memory pressure of the parent process.
Example fix
// before
const out = runGhJson(['api', 'repos/o/r']);
// after
try {
const out = runGhJson(['api', 'repos/o/r']);
} catch (e) {
if (!commandExists('gh')) {
throw new Error('gh CLI is required: https://cli.github.com');
}
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
const ghOnPath = spawnSync('gh', ['--version']).status === 0;
if (!ghOnPath) throw new Error('gh CLI not installed or not on PATH'); Try / catch
try {
const out = runCommand('gh', args);
} catch (e) {
if (/failed: .*ENOENT/.test(e.message)) {
throw new Error('gh CLI missing — install https://cli.github.com and ensure it is on PATH');
}
throw e;
} Prevention
- Install gh in every environment (CI image, container, dev machine) the code runs in.
- Verify PATH includes gh before spawning in stripped-down contexts (cron, serverless).
- Check binary execute permissions after manual installs.
When it happens
Trigger: Calling runCommand/runGhJson when the 'gh' binary is not on PATH (ENOENT), the binary lacks execute permission (EACCES), or the child is killed by a signal; spawnSync returns { error } instead of a status.
Common situations: GitHub CLI not installed in the container/CI image; PATH stripped in a cron or serverless context; antivirus or permissions blocking execution; ENOMEM from spawning in a constrained environment.
Related errors
- Codex probe failed
- failed
- The local Itô CLI could not be started
- Claude Code did not expose a process id
- Codex invocation failed
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/2345eeca250341b1.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/github-discussions.js:27
function splitRepo(repo) {
const [owner, name] = String(repo || '').split('/');
if (!owner || !name) {
throw new Error(`Invalid repo: ${repo}`);
}
return { owner, name };
}
function runCommand(command, args, options = {}) {
const result = spawnSync(command, args, {
cwd: options.cwd,
env: options.env || process.env,
encoding: 'utf8',
maxBuffer: 10 * 1024 * 1024,
});
if (result.error) {
throw new Error(`${command} ${args.join(' ')} failed: ${result.error.message}`);
}
if (result.status !== 0) {
throw new Error(`${command} ${args.join(' ')} failed: ${(result.stderr || result.stdout || '').trim()}`);
}
return result.stdout || '';
}
function runGhJson(args, options = {}) {
const shimPath = process.env.ECC_GH_SHIM;
const command = shimPath ? process.execPath : 'gh';
const commandArgs = shimPath ? [shimPath, ...args] : args;
const env = { ...process.env };
if (!options.useEnvGithubToken) {
delete env.GITHUB_TOKEN;
}View on GitHub (pinned to 8321021c54)