affaan-m/ECC · error · Error
Invalid issue number: ${value}
Error message
Invalid issue number: ${value} What it means
Thrown by normalizeIssueNumber in gh-api.js when the value cannot be parsed via parseInt into a finite positive number. This is the gh-api-layer guard (companion to actions.js assertValidIssueNumber) and is slightly looser: it does not require an integer (parseInt already truncates), only > 0 and finite. It protects every gh issue view/list call from garbage input.
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 01e15490f0)
Solutions
- Pass a positive integer (or its string form like '42').
- Strip non-digits and '#' before parsing: const n = Number.parseInt(String(raw).replace(/[^0-9]/g, ''), 10).
- Validate at the input boundary: if (!(Number.isFinite(n) && n > 0)) throw.
- Coordinate with assertValidIssueNumber upstream so malformed numbers are caught earlier with a clearer message.
Example fix
// before
getIssue(repo, rawIssue);
// after — normalize defensively
const issueNumber = Number.parseInt(String(rawIssue).replace(/[^0-9]/g, ''), 10);
if (!Number.isFinite(issueNumber) || issueNumber <= 0) {
throw new Error(`Invalid issue number: ${rawIssue}`);
}
getIssue(repo, issueNumber); Defensive patterns
Strategy: validation
Validate before calling
const n = Number.parseInt(String(value).replace(/[^0-9]/g, ''), 10);
if (!Number.isFinite(n) || n <= 0) {
throw new Error(`issue number must be positive, got ${value}`);
} Type guard
function isPositiveIssueNumber(value) {
const n = Number.parseInt(String(value), 10);
return Number.isFinite(n) && n > 0;
} Try / catch
try {
getIssue(repo, issueNumber);
} catch (e) {
if (/Invalid issue number/.test(e.message)) { console.error('Pass a positive integer issue number'); process.exit(2); }
throw e;
} Prevention
- Strip non-digits before parsing issue references.
- Validate at the input boundary, not at the gh-api layer.
- Coordinate with assertValidIssueNumber upstream.
When it happens
Trigger: Passing 'abc', '', '#', null, 0, -1, or NaN as the issue number; a value that parseInt cannot turn into a positive integer.
Common situations: CLI/web param not converted to a number; issue ref includes text parseInt can't handle; default sentinel 0 or -1 leaked through; empty string from a missing field.
Related errors
- invalid issueNumber: expected positive integer, got ${JSON.s
- Invalid repo format: "${repo}". Expected "owner/repo".
- invalid repo: expected non-empty string, got ${JSON.stringif
- Issue #${issueNumber} is not ready to publish: ${validation.
- ${command} ${args.join(' ')} failed: ${result.error.message}
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/ca56cde175d79a20.
Report an issue: GitHub.