affaan-m/ECC · error · Error
${command} ${args.join(' ')} failed: ${result.error.message}
Error message
${command} ${args.join(' ')} failed: ${result.error.message} What it means
Thrown by runCommand in platform-audit when `spawnSync` returns a non-null `error` — meaning the child process could not be spawned at all (command not found, permission denied, EACCES/ENOENT). This is distinct from a non-zero exit status; `result.error` is set by Node when the binary itself is unreachable. The message interpolates the raw Node error string for diagnosis.
Source
Thrown at scripts/platform-audit.js:234
}
function normalizeRelativePrefix(value) {
return String(value || '')
.replace(/\\/g, '/')
.replace(/^\.\/+/, '')
.replace(/\/+$/, '') + (String(value || '').endsWith('/') ? '/' : '');
}
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 01e15490f0)
Solutions
- Verify the binary is installed and on PATH: `which gh git node`.
- Install missing tool (e.g. `gh auth login` after installing GitHub CLI), or pass `--skip-github` to bypass gh.
- If using ECC_GH_SHIM, confirm the shim file exists and is executable; unset it to fall back to real `gh`.
- Ensure the parent process env (used as default) includes the directory containing the binary.
Example fix
# before — gh not installed node scripts/platform-audit.js # after — install gh, or skip github checks node scripts/platform-audit.js --skip-github
Defensive patterns
Strategy: validation
Validate before calling
const { spawnSync } = require('child_process');
function binaryAvailable(name) {
const r = process.platform === 'win32'
? spawnSync('where', [name], { encoding: 'utf8' })
: spawnSync('command', ['-v', name], { encoding: 'utf8', shell: true });
return r.status === 0 && (r.stdout || '').trim().length > 0;
} Type guard
function isSpawnError(result) {
return result && Object.prototype.hasOwnProperty.call(result, 'error') && result.error !== null;
} Try / catch
try {
runCommand('gh', ['repo','view','--json','name'], { env });
} catch (err) {
if (/failed: .*ENOENT/.test(err.message)) {
console.error('gh not found on PATH. Install GitHub CLI or pass --skip-github.');
process.exit(127);
}
throw err;
} Prevention
- Ensure git, gh, node are installed and on PATH in CI and locally.
- Validate ECC_GH_SHIM points to an existing executable file.
- Pass --skip-github in environments without gh to avoid this path.
When it happens
Trigger: Calling `git`/`gh`/`node` when not on PATH (ENOENT); the binary exists but is not executable (EACCES); a shim path (ECC_GH_SHIM) points to a missing file; spawning on an OS where the command name differs.
Common situations: CI image missing gh; local install where `gh` is absent but `--skip-github` was not passed; ECC_GH_SHIM env var stale after a move; PATH not propagated into the spawned env.
Related errors
- ${command} ${args.join(' ')} failed: ${result.error.message}
- Codex CLI is not installed
- ECC_PROJECT_DIR must be an absolute path within /workspace.
- ${command} ${args.join(' ')} failed: ${result.error.message}
- ${command} ${args.join(' ')} failed: ${(result.stderr || res
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/959b35729f465222.
Report an issue: GitHub.