can1357/oh-my-pi · error
Invalid lookback: ${value}
Error message
Invalid lookback: ${value} What it means
Thrown by parseCloudOptions when the --lookback flag value for /security cloud is neither the literal "all" nor a positive safe integer. The parser converts the token with Number() and rejects NaN, zero, negatives, fractions, and oversized values. It guards the Codex Security cloud scan API from receiving an invalid time window.
Source
Thrown at packages/coding-agent/src/slash-commands/helpers/security.ts:245
options.credentialId = parsePositiveCredential(requireToken(tokens, ++index, token));
break;
case "--repo-id":
options.repositoryId = requireToken(tokens, ++index, token);
break;
case "--repo-url":
options.repositoryUrl = requireToken(tokens, ++index, token);
break;
case "--environment":
options.environmentId = requireToken(tokens, ++index, token);
break;
case "--lookback": {
const value = requireToken(tokens, ++index, token);
if (value === "all") {
options.lookbackDays = value;
break;
}
const days = Number(value);
if (!Number.isSafeInteger(days) || days < 1) throw new Error(`Invalid lookback: ${value}`);
options.lookbackDays = days;
break;
}
default:
if (!token.startsWith("--") && !positionalConsumed && (subcommand === "status" || subcommand === "pull")) {
options.configurationId = token;
positionalConsumed = true;
break;
}
throw new Error(`Unknown security cloud option: ${token}`);
}
}
return options;
}
function cloudClientFor(runtime: SlashCommandRuntime, credentialId?: number): CodexSecurityCloudClient {
const authStorage = runtime.session.modelRegistry.authStorage;
const account = selectSecurityAccount(authStorage, "openai-codex", credentialId, runtime.session.sessionId);View on GitHub (pinned to 9690622007)
Solutions
- Pass a bare positive integer, e.g. `--lookback 30`.
- Use `--lookback all` to scan the full history instead of a day count.
- Omit --lookback entirely if the API default window is acceptable.
Example fix
// before /security cloud start --repo-id r1 --repo-url https://x --environment e1 --lookback 30d // after /security cloud start --repo-id r1 --repo-url https://x --environment e1 --lookback 30
Defensive patterns
Strategy: validation
Validate before calling
const raw = "30d"; // value you plan to pass to --lookback
const valid = raw === "all" || (Number.isSafeInteger(Number(raw)) && Number(raw) >= 1);
if (!valid) throw new Error(`Use "all" or a positive integer, got: ${raw}`); Type guard
function isValidLookback(v: string): v is `${number}` | "all" {
return v === "all" || (Number.isSafeInteger(Number(v)) && Number(v) >= 1);
} Prevention
- Always pass --lookback as a bare positive integer (30), never a duration string (30d).
- Use the literal `all` for unlimited history.
- Omit --lookback to accept the default window.
When it happens
Trigger: Run `/security cloud start --repo-id X --repo-url Y --environment Z --lookback 7d` or `--lookback -3` or `--lookback 0` or `--lookback all-time` — any --lookback value other than "all" or a positive integer like 30.
Common situations: Typing unit suffixes like "30d" or "7days" out of habit; passing 0 or negative numbers expecting 'no limit'; quoting values with spaces; copying lookback syntax from other CLIs that accept duration strings.
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
- invalid {} argument: {}
- invalid Zero increment value: {}
- --agents must be a positive integer
- --trusted-extension requires a non-empty, non-flag value
- Invalid --state '${raw}'. Valid values: ${GALLERY_STATE_TOKE
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/73cb00f0b74b31dc.
Report an issue: GitHub.