{"record":{"id":"985d92153bbabb43","repo":"affaan-m/ECC","slug":"invalid-repo-expected-non-empty-string-got-jso","errorCode":null,"errorMessage":"invalid repo: expected non-empty string, got ${JSON.stringify(repo)}","messagePattern":"invalid repo: expected non-empty string, got (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/github-coordination/actions.js","lineNumber":21,"sourceCode":"const { loadPolicy } = require('./policy');\nconst { mergeIssueBody, normalizeBodyForComparison } = require('./parsing');\nconst { getIssue, listIssues, editIssue, commentIssue, normalizeLabels } = require('./gh-api');\nconst {\n  assertIssueClaimable,\n  buildIssueComment,\n  buildIssueStateFromAction,\n  desiredLabelsForState,\n  getCoordinationState,\n  summarizeStateForOutput,\n  syncIssueLabels,\n  verifyDependenciesClosed,\n} = require('./state');\nconst { upsertCoordinationWorkItem } = require('./store');\nconst { extractIssueReferences, extractTasks } = require('./parsing');\n\nfunction assertValidRepo(repo) {\n  if (typeof repo !== 'string' || !repo.trim()) {\n    throw new Error(`invalid repo: expected non-empty string, got ${JSON.stringify(repo)}`);\n  }\n}\n\nfunction assertValidIssueNumber(issueNumber) {\n  if (!Number.isFinite(issueNumber) || issueNumber <= 0 || !Number.isInteger(issueNumber)) {\n    throw new Error(`invalid issueNumber: expected positive integer, got ${JSON.stringify(issueNumber)}`);\n  }\n}\n\nfunction staleCoordinationLabels(issue, nextLabels, policy) {\n  const epicLabel = policy.labels && policy.labels.epic;\n  return normalizeLabels(issue.labels).filter(l =>\n    (l.startsWith('coordination:') || l === epicLabel) && !nextLabels.includes(l)\n  );\n}\n\n// applyClaim performs a read (getIssue) → check (assertIssueClaimable) → write\n// (editIssue) sequence that is NOT atomic. Two concurrent callers can both read","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/github-coordination/actions.js#L3-L39","documentation":"Thrown by assertValidRepo in github-coordination/actions.js when repo is not a non-empty string. Every coordination action (applyClaim, applyPublish, etc.) targets exactly one GitHub repository identified as 'owner/name'; a missing repo makes all downstream gh calls meaningless. This guard runs before any network/spawn so it fails fast.","triggerScenarios":"Calling applyPublish(undefined, 12) or applyPublish('', 12); repo read from an unset env var or a missing config field; repo passed as an object or number by mistake.","commonSituations":"Env var ECC_REPO / GITHUB_REPOSITORY unset in CI; config file missing the repo key; CLI flag --repo forgotten; programmatic caller destructured wrong field name.","solutions":["Pass repo as a non-empty 'owner/name' string.","Resolve repo from env/config once at startup and fail loudly there if missing: const repo = process.env.GITHUB_REPOSITORY; if (!repo) throw new Error('Set GITHUB_REPOSITORY=owner/name').","Add a CLI --repo required flag with a validator.","Unit-test assertValidRepo with undefined/''/number to lock the guard."],"exampleFix":"// before\napplyPublish(repo, issueNumber);\n\n// after — resolve and validate at the boundary\nconst repo = process.env.GITHUB_REPOSITORY;\nif (typeof repo !== 'string' || !repo.trim()) {\n  throw new Error('GITHUB_REPOSITORY must be set to owner/name');\n}\napplyPublish(repo.trim(), issueNumber);","handlingStrategy":"validation","validationCode":"if (typeof repo !== 'string' || !repo.trim()) {\n  throw new Error('repo must be a non-empty \"owner/name\" string');\n}","typeGuard":"function isNonEmptyRepoString(repo) {\n  return typeof repo === 'string' && repo.trim().length > 0;\n}","tryCatchPattern":"try {\n  applyPublish(repo, issueNumber);\n} catch (e) {\n  if (/invalid repo/.test(e.message)) { console.error('Set GITHUB_REPOSITORY=owner/name'); process.exit(2); }\n  throw e;\n}","preventionTips":["Resolve repo from env/config once at startup and fail there if missing.","Require a --repo CLI flag with validation.","Unit-test assertValidRepo with undefined/''/number/null."],"tags":["github-coordination","validation","precondition","config"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}