jackwener/OpenCLI · warning
[runtime] Invalid ${envVar}="${raw}", using default ${fallba
Error message
[runtime] Invalid ${envVar}="${raw}", using default ${fallback}s What it means
parseEnvTimeout reads an integer-milliseconds-style timeout variable (e.g. OPENCLI_BROWSER_CONNECT_TIMEOUT, OPENCLI_BROWSER_COMMAND_TIMEOUT) from the environment. If the variable is set but does not parse as a positive integer, the library logs this warning and falls back to the built-in default (in seconds, hence the 's' suffix in the message). Execution continues with defaultTimeout semantics.
Source
Thrown at src/browser/config.ts:8
import { log } from '../logger.js';
function parseEnvTimeout(envVar: string, fallback: number): number {
const raw = process.env[envVar];
if (raw === undefined) return fallback;
const parsed = parseInt(raw, 10);
if (Number.isNaN(parsed) || parsed <= 0) {
log.warn(`[runtime] Invalid ${envVar}="${raw}", using default ${fallback}s`);
return fallback;
}
return parsed;
}
export const DEFAULT_BROWSER_CONNECT_TIMEOUT = parseEnvTimeout('OPENCLI_BROWSER_CONNECT_TIMEOUT', 45);
export const DEFAULT_BROWSER_COMMAND_TIMEOUT = parseEnvTimeout('OPENCLI_BROWSER_COMMAND_TIMEOUT', 60);
View on GitHub (pinned to 49907e53dc)
Solutions
- Set the variable to a plain positive integer, e.g. export OPENCLI_BROWSER_CONNECT_TIMEOUT=90.
- Remove units ('s', 'ms', 'm') from the value; seconds are implied by the documented default.
- Unset the variable entirely to use the built-in default (45s connect timeout).
- Check shell startup files (.bashrc/.zshrc) for a stale or malformed export.
Example fix
// before export OPENCLI_BROWSER_CONNECT_TIMEOUT="45s" // after export OPENCLI_BROWSER_CONNECT_TIMEOUT=45
Defensive patterns
Strategy: validation
Validate before calling
const v = process.env.OPENCLI_BROWSER_CONNECT_TIMEOUT;
const ok = v === undefined || (/^\d+$/.test(v) && parseInt(v, 10) > 0);
if (!ok) throw new Error(`OPENCLI_BROWSER_CONNECT_TIMEOUT must be a positive integer, got "${v}"`); Type guard
function isValidTimeout(raw) {
if (raw === undefined) return true;
const n = Number(raw);
return Number.isInteger(n) && n > 0;
} Prevention
- Set timeout env vars as bare positive integers with no units (e.g. 45, not 45s).
- Unset the variable to use defaults instead of guessing formats.
- Check shell rc files for malformed exports after editing timeouts.
When it happens
Trigger: OPENCLI_BROWSER_CONNECT_TIMEOUT or OPENCLI_BROWSER_COMMAND_TIMEOUT is set to a non-numeric string (e.g. '45s', 'one minute'), zero, or a negative number, so parseInt yields NaN or <= 0.
Common situations: Users writing '45s' or '1m' in shell profiles (the parser expects a bare integer); quoting mistakes leaving units in the value; locale-formatted numbers; setting the var to 0 intending 'no timeout'.
Related errors
- OPENCLI_DAEMON_PORT is no longer supported${suffix}. The Ope
- Unexpected 12306 probe: ${JSON.stringify(probe)}
- Missing ${label}
- Invalid ${label}: ${raw}
- ${config.site} login
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/05e5a79702edb1ff.
Report an issue: GitHub.