affaan-m/ECC · error
Invalid issue number
Error message
Invalid issue number: ${value} What it means
normalizeIssueNumber validates that a value can be parsed as a positive integer issue number before any gh API call is made. It throws when the value is not an integer or is <= 0, because GitHub issue numbers are strictly positive integers. This is an early input-validation guard so malformed numbers fail fast instead of producing a confusing gh CLI error.
Solutions
- Pass the bare positive integer issue number, e.g. 123 not '#123' or a URL.
- Strip prefixes and whitespace before calling: Number.parseInt(value.replace('#','').trim(), 10).
- Check that the variable holding the number is actually set in your shell/script before invoking the command.
- If deriving the number from a URL, extract the final numeric path segment first.
Example fix
// before
node script.js issue --issue "$ISSUE_URL"
// after
const num = Number.parseInt(ISSUE_URL.split('/').pop().replace('#', ''), 10);
if (Number.isFinite(num) && num > 0) node script.js issue --issue num; Defensive patterns
Strategy: validation
Validate before calling
function isValidIssueNumber(v) {
const n = Number.parseInt(String(v).trim().replace(/^#/, ''), 10);
return Number.isFinite(n) && n > 0;
}
if (!isValidIssueNumber(input)) throw new Error(`Bad issue number: ${input}`); Type guard
const isPositiveInt = (v) => Number.isFinite(Number.parseInt(String(v), 10)) && Number.parseInt(String(v), 10) > 0;
Try / catch
let num;
try {
num = normalizeIssueNumber(raw);
} catch (e) {
if (e.message.startsWith('Invalid issue number')) {
console.error(`Please pass a positive integer, got: ${raw}`);
process.exitCode = 1;
return;
}
throw e;
} Prevention
- Always pass bare integers, not '#123' or URLs.
- Strip '#' and whitespace before parsing.
- Validate shell variables are non-empty before interpolation.
- Centralize issue-number parsing in one helper used by all scripts.
When it happens
Trigger: Calling getIssue/issue/applyClaim (via VALUE_FLAGS or parseArgs) with a non-numeric string like 'abc', a float like '12.5', a zero or negative number like '0' or '-3', or an empty/undefined value passed as the issue identifier.
Common situations: Users pass a branch name or PR URL fragment instead of a number, scripts interpolate an unset shell variable producing an empty string, users pass a GitHub URL (#123 or full URL) rather than the bare number, or a parsed value includes trailing whitespace/characters like '123, '.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- exceeds the -byte limit
- must be a regular file
- memory body is too large
- Agents directory not found
- --all-harnesses and --harness are mutually exclusive.
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/ca56cde175d79a20.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/github-coordination/gh-api.js:17
'use strict';
const { spawnSync } = require('child_process');
function normalizeRepo(repo) {
const parts = String(repo || '').split('/').filter(Boolean);
if (parts.length !== 2) {
throw new Error(`Invalid repo format: "${repo}". Expected "owner/repo".`);
}
const [owner, name] = parts;
return { owner, name };
}
function normalizeIssueNumber(value) {
const parsed = Number.parseInt(String(value), 10);
if (!Number.isFinite(parsed) || parsed <= 0) {
throw new Error(`Invalid issue number: ${value}`);
}
return parsed;
}
function normalizeLabelValue(label) {
if (typeof label === 'string') {
return label.trim();
}
if (label && typeof label === 'object') {
return String(label.name || label.label || '').trim();
}
return '';
}
function normalizeLabels(labels) {
return Array.from(new Set((Array.isArray(labels) ? labels : []).map(normalizeLabelValue).filter(Boolean))).sort();
}
View on GitHub (pinned to 8321021c54)