koala73/worldmonitor · error
MCP_SMOKE_RUN_BUDGET_MS must be a positive number
Error message
MCP_SMOKE_RUN_BUDGET_MS must be a positive number
What it means
The smoke script reads MCP_SMOKE_RUN_BUDGET_MS to set a run deadline. If the value is not a finite number greater than 0 (including unset-but-present empty strings or non-numeric strings), it throws 'MCP_SMOKE_RUN_BUDGET_MS must be a positive number'. Number() of a non-numeric string is NaN, which fails the guard.
Solutions
- Set MCP_SMOKE_RUN_BUDGET_MS to a positive integer in milliseconds, e.g. 600000
- Unset the variable to fall back to DEFAULT_RUN_BUDGET_MS
- Fix non-numeric characters (spaces, units) in the value
Example fix
// before export MCP_SMOKE_RUN_BUDGET_MS="" // after export MCP_SMOKE_RUN_BUDGET_MS=600000
Defensive patterns
Strategy: validation
Validate before calling
const raw = process.env.MCP_SMOKE_RUN_BUDGET_MS;
const ms = raw === undefined ? undefined : Number(raw);
if (ms !== undefined && !(Number.isFinite(ms) && ms > 0)) throw new Error(`MCP_SMOKE_RUN_BUDGET_MS must be a positive number, got ${JSON.stringify(raw)}`); Type guard
const isPositiveNumber = (v) => typeof v === 'number' && Number.isFinite(v) && v > 0;
Try / catch
try {
runBudgetMs = Number(process.env.MCP_SMOKE_RUN_BUDGET_MS ?? DEFAULT_RUN_BUDGET_MS);
if (!(Number.isFinite(runBudgetMs) && runBudgetMs > 0)) throw new Error('MCP_SMOKE_RUN_BUDGET_MS must be a positive number');
} catch (err) {
console.error(`${err.message}; using default ${DEFAULT_RUN_BUDGET_MS}ms`);
} Prevention
- Set the value as a plain positive integer of milliseconds
- Never leave the env var empty-string in CI or .env files
- Validate env values in CI before running the smoke script
When it happens
Trigger: Exporting MCP_SMOKE_RUN_BUDGET_MS="abc" (NaN), "0", "-5000", or "" (empty string coerces to 0), then running the script.
Common situations: CI secrets or .env files with an empty or mistyped value; quoting mistakes like MCP_SMOKE_RUN_BUDGET_MS="30 000"; unit confusion (passing seconds instead of milliseconds like "30").
Understand the failure class
Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.
Related errors
- Acquisition provider
- : editorialLinks must be an array
- Convex unavailable
- EXA_API_KEY is required for exa-search adapter
- Generic adapter requires acquisition config
AI-assisted analysis of koala73/worldmonitor@e586b8b4b8 (2026-09-22).
Data as JSON: /api/errors/d9a1d31bb7c4beaa.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/mcp-live-smoke.mjs:864
};
try {
writeFileSync(reportPath, `${JSON.stringify(report, null, 2)}\n`, 'utf8');
console.log(`MCP smoke report: ${reportPath}`);
return true;
} catch (error) {
console.error(`Unable to write MCP smoke report: ${formatSafeError(error)}`);
return false;
}
}
async function main() {
let completedAllGroups = false;
let reportPath = null;
try {
reportPath = reportPathFromArgs(process.argv.slice(2));
runBudgetMs = Number(process.env.MCP_SMOKE_RUN_BUDGET_MS ?? DEFAULT_RUN_BUDGET_MS);
if (!(Number.isFinite(runBudgetMs) && runBudgetMs > 0)) {
throw new Error('MCP_SMOKE_RUN_BUDGET_MS must be a positive number');
}
runDeadlineAt = Date.now() + runBudgetMs;
console.log('\n── canonical ──');
for (const host of HOSTS) {
await walkHost(host);
stopIfRunBudgetExhausted();
await probeDiscovery(host);
stopIfRunBudgetExhausted();
}
completeGroup('canonical');
console.log('\n── aliases ──');
for (const host of ALIAS_HOSTS) {
await probeAliasMigration(host);
stopIfRunBudgetExhausted();
}
completeGroup('aliases');View on GitHub (pinned to e586b8b4b8)