Hmbown/CodeWhale · error · Error
--days must be an integer from 1 through 90
Error message
--days must be an integer from 1 through 90
What it means
parseArgs requires the --days value to be an integer between 1 and 90 inclusive (Number.isInteger(days) && days >= 1 && days <= 90). This bounds the active-installs report to a sane window; anything outside — non-numeric text, floats, 0, negatives, or values beyond 90 — throws this error.
Solutions
- Pass a plain integer between 1 and 90: --days 30.
- Ensure a value actually follows --days (a missing value becomes NaN).
- If you need a longer window, run the report multiple times (e.g. several 90-day spans) or adjust the 1–90 bound in parseArgs deliberately.
- Validate/normalize the number in the wrapper script before invoking (Number.isInteger check).
Example fix
// before node scripts/report-active-installs.mjs --days 365 // after node scripts/report-active-installs.mjs --days 90
Defensive patterns
Strategy: validation
Validate before calling
const days = Number(process.argv[process.argv.indexOf('--days') + 1]);
if (!Number.isInteger(days) || days < 1 || days > 90) {
console.error('--days must be an integer from 1 through 90');
} Type guard
const isReportWindow = (n) => Number.isInteger(n) && n >= 1 && n <= 90;
Try / catch
try {
await main(process.argv.slice(2));
} catch (err) {
if (err.message.startsWith('--days must be')) {
console.error('example: --days 30 (integer, 1-90)'); process.exit(2);
}
throw err;
} Prevention
- Always supply an integer immediately after --days.
- Clamp wrapper-script day windows to [1, 90] before invoking.
- Never pass identifiers like 'week' or '1m'; convert to days in the caller.
- Remember missing values become NaN and are rejected.
When it happens
Trigger: --days followed by a missing or non-numeric value (Number(undefined) => NaN, Number('abc') => NaN), a decimal like 7.5, 0, a negative number, or an integer greater than 90 such as --days 365.
Common situations: Forgetting the value after --days; passing 'week' or '1m' instead of a number; trying a year-long report and hitting the 90-day cap; locale-formatted numbers like '7,5'.
Related errors
- Choose one input source, an unused --output path (or…
- duration resolved to zero seconds
- Invalid native whale body.
- invalid value ' ' for '--provider ': expected one of …
- --max-passes applies only to --pr reviews
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/51a376d8107267dc.
Report an issue: GitHub.
Appendix: source
Thrown at telemetry-ingest/scripts/report-active-installs.mjs:50
// window that fills both sides of the 7-day trend.
let days = 15;
let json = false;
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === "--json") {
json = true;
continue;
}
if (arg === "--days") {
const raw = argv[index + 1];
index += 1;
days = Number(raw);
continue;
}
throw new Error(`unknown argument: ${arg}`);
}
if (!Number.isInteger(days) || days < 1 || days > 90) {
throw new Error("--days must be an integer from 1 through 90");
}
return { days, json };
}
export function activeInstallsSql(days) {
return `SELECT
toDate(timestamp) AS day,
count(DISTINCT index1) AS active_installs,
sum(_sample_interval) AS sessions_started
FROM codewhale_telemetry
WHERE timestamp >= toStartOfDay(NOW()) - INTERVAL '${days - 1}' DAY
AND blob1 = 'session_start'
GROUP BY day
ORDER BY day DESC
FORMAT JSON`;
}
/** Newest ingested event of any kind — how stale the dataset is. */View on GitHub (pinned to 433685b202)