affaan-m/ECC · error · Error
Failed to run gh
Error message
Failed to run gh: ${result.error.message} What it means
runGhJson throws when spawnSync fails to launch the gh command (or the ECC_GH_SHIM node shim) at all — typically gh not installed or not on PATH. The faulting input is the spawned command; result.error's message is embedded.
Solutions
- Install the GitHub CLI (gh) and ensure it is on PATH, or authenticate it (gh auth login).
- If using ECC_GH_SHIM, verify the shim path exists and node can execute it.
- Check filesystem permissions on the gh binary.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at scripts/work-items.js:156 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/bdb6e70ad9454b15.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/work-items.js:156
const parsed = Number.parseInt(value, 10);
if (!Number.isFinite(parsed) || parsed <= 0) {
throw new Error(`Invalid limit: ${value}`);
}
return parsed;
}
function runGhJson(args) {
const shimPath = process.env.ECC_GH_SHIM;
const command = shimPath ? process.execPath : 'gh';
const commandArgs = shimPath ? [shimPath, ...args] : args;
const displayCommand = shimPath ? `node ${shimPath} ${args.join(' ')}` : `gh ${args.join(' ')}`;
const result = spawnSync(command, commandArgs, {
encoding: 'utf8',
maxBuffer: 10 * 1024 * 1024
});
if (result.error) {
throw new Error(`Failed to run gh: ${result.error.message}`);
}
if (result.status !== 0) {
throw new Error(`${displayCommand} failed: ${(result.stderr || result.stdout || '').trim()}`);
}
try {
return JSON.parse(result.stdout || '[]');
} catch (error) {
throw new Error(`${displayCommand} returned invalid JSON: ${error.message}`);
}
}
function slugifyWorkItemSegment(value) {
return (
String(value || '')
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')View on GitHub (pinned to 8321021c54)