affaan-m/ECC · error · Error

failed

Error message

${displayCommand} failed: ${(result.stderr || result.stdout || '').trim()}

What it means

runGhJson throws when the gh (or shim) process exits non-zero; the command's stderr (or stdout) output is embedded. Common causes are expired gh auth, unknown repo, or network failure — the faulting input is the arguments passed to the gh invocation.

Solutions

  1. Read the embedded gh output for the concrete failure (auth, repo, rate limit).
  2. Run `gh auth status` and re-authenticate if needed.
  3. Verify the --repo owner/repo value exists and is accessible.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at scripts/work-items.js:160 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/66a81cf8f4e4ade3. Report an issue: GitHub.

Appendix: source

Thrown at scripts/work-items.js:160

  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, '-')
      .replace(/^-+|-+$/g, '') || 'unknown'
  );
}

View on GitHub (pinned to 8321021c54)