{"record":{"id":"66a81cf8f4e4ade3","repo":"affaan-m/ECC","slug":"displaycommand-failed-result-stderr-resu","errorCode":null,"errorMessage":"${displayCommand} failed: ${(result.stderr || result.stdout || '').trim()}","messagePattern":"(.+?) failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/work-items.js","lineNumber":160,"sourceCode":"  return parsed;\n}\n\nfunction runGhJson(args) {\n  const shimPath = process.env.ECC_GH_SHIM;\n  const command = shimPath ? process.execPath : 'gh';\n  const commandArgs = shimPath ? [shimPath, ...args] : args;\n  const displayCommand = shimPath ? `node ${shimPath} ${args.join(' ')}` : `gh ${args.join(' ')}`;\n  const result = spawnSync(command, commandArgs, {\n    encoding: 'utf8',\n    maxBuffer: 10 * 1024 * 1024\n  });\n\n  if (result.error) {\n    throw new Error(`Failed to run gh: ${result.error.message}`);\n  }\n\n  if (result.status !== 0) {\n    throw new Error(`${displayCommand} failed: ${(result.stderr || result.stdout || '').trim()}`);\n  }\n\n  try {\n    return JSON.parse(result.stdout || '[]');\n  } catch (error) {\n    throw new Error(`${displayCommand} returned invalid JSON: ${error.message}`);\n  }\n}\n\nfunction slugifyWorkItemSegment(value) {\n  return (\n    String(value || '')\n      .toLowerCase()\n      .replace(/[^a-z0-9]+/g, '-')\n      .replace(/^-+|-+$/g, '') || 'unknown'\n  );\n}\n","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/work-items.js#L142-L178","documentation":"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.","triggerScenarios":"Thrown at scripts/work-items.js:160 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the embedded gh output for the concrete failure (auth, repo, rate limit).","Run `gh auth status` and re-authenticate if needed.","Verify the --repo owner/repo value exists and is accessible."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}