{"record":{"id":"2382bfb2dfe744ea","repo":"affaan-m/ECC","slug":"unable-to-load-issue-issuenumber-from-repo","errorCode":null,"errorMessage":"Unable to load issue #${issueNumber} from ${repo}","messagePattern":"Unable to load issue #(.+?) from (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/github-coordination/gh-api.js","lineNumber":95,"sourceCode":"  } catch (error) {\n    throw new Error(`gh ${args.join(' ')} returned invalid JSON: ${error.message}`);\n  }\n}\n\nfunction getIssue(repo, issueNumber, options = {}) {\n  const { owner, name } = normalizeRepo(repo);\n  const json = runGhJson([\n    'issue',\n    'view',\n    String(issueNumber),\n    '--repo',\n    `${owner}/${name}`,\n    '--json',\n    'number,title,body,url,state,labels,author,updatedAt,assignees',\n  ], options);\n\n  if (!json) {\n    throw new Error(`Unable to load issue #${issueNumber} from ${repo}`);\n  }\n\n  return json;\n}\n\nfunction listIssues(repo, options = {}) {\n  const { owner, name } = normalizeRepo(repo);\n  const limit = Number.isFinite(options.limit) ? options.limit : 100;\n  const state = options.state || 'all';\n  const args = [\n    'issue',\n    'list',\n    '--repo',\n    `${owner}/${name}`,\n    '--state',\n    state,\n    '--limit',\n    String(limit),","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/github-coordination/gh-api.js#L77-L113","documentation":"getIssue throws when the `gh issue view --json ...` call succeeds but returns an empty result, so the library cannot return an issue object. Since gh normally errors on a missing issue, an empty JSON result is treated as 'issue not retrievable' and surfaced with this explicit message naming the issue number and repo.","triggerScenarios":"Calling getIssue (exposed as issue) with a repo/issue combination where gh returns null/empty JSON — e.g. the issue number does not exist in the repo, or a shim returns an empty body for the lookup.","commonSituations":"Typo in the issue number, referencing an issue in the wrong repo slug, an issue deleted or converted (e.g. to a discussion), or a custom shim that stubs responses and has no data for that issue.","solutions":["Verify the issue exists: open https://github.com/<owner>/<name>/issues/<n> or run `gh issue view <n> -R <owner>/<name>`.","Confirm the repo slug passed via --repo/-R is correct.","Check you are authenticated with a token that can see the repo (private repos need access).","If using ECC_GH_SHIM, ensure the shim returns data for this issue."],"exampleFix":"// before\ngetIssue('org/wrong-repo', 42);\n// after\ngetIssue('org/correct-repo', 42);","handlingStrategy":"try-catch","validationCode":"const exists = runGh(['issue', 'view', String(n), '-R', repo, '--json', 'number']);\nif (!exists || !JSON.parse(exists).number) throw new Error(`Issue #${n} not found in ${repo}`);","typeGuard":"null","tryCatchPattern":"try {\n  const issue = getIssue(repo, n);\n} catch (e) {\n  if (e.message.startsWith('Unable to load issue')) {\n    console.error(`Verify ${repo}/issues/${n} exists and your token can access ${repo}.`);\n  } else { throw e; }\n}","preventionTips":["Confirm issue URLs/numbers before scripting against them.","Use the exact owner/name repo slug from `gh repo view --json nameWithOwner`.","Ensure your token has access to private repos.","Keep shims' fixture data in sync with real issue numbers."],"tags":["github-issues","not-found","gh-cli"],"backgroundTag":"record-not-found","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"}