{"record":{"id":"73cb00f0b74b31dc","repo":"can1357/oh-my-pi","slug":"invalid-lookback-value","errorCode":null,"errorMessage":"Invalid lookback: ${value}","messagePattern":"Invalid lookback: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/slash-commands/helpers/security.ts","lineNumber":245,"sourceCode":"\t\t\t\toptions.credentialId = parsePositiveCredential(requireToken(tokens, ++index, token));\n\t\t\t\tbreak;\n\t\t\tcase \"--repo-id\":\n\t\t\t\toptions.repositoryId = requireToken(tokens, ++index, token);\n\t\t\t\tbreak;\n\t\t\tcase \"--repo-url\":\n\t\t\t\toptions.repositoryUrl = requireToken(tokens, ++index, token);\n\t\t\t\tbreak;\n\t\t\tcase \"--environment\":\n\t\t\t\toptions.environmentId = requireToken(tokens, ++index, token);\n\t\t\t\tbreak;\n\t\t\tcase \"--lookback\": {\n\t\t\t\tconst value = requireToken(tokens, ++index, token);\n\t\t\t\tif (value === \"all\") {\n\t\t\t\t\toptions.lookbackDays = value;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst days = Number(value);\n\t\t\t\tif (!Number.isSafeInteger(days) || days < 1) throw new Error(`Invalid lookback: ${value}`);\n\t\t\t\toptions.lookbackDays = days;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tif (!token.startsWith(\"--\") && !positionalConsumed && (subcommand === \"status\" || subcommand === \"pull\")) {\n\t\t\t\t\toptions.configurationId = token;\n\t\t\t\t\tpositionalConsumed = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Unknown security cloud option: ${token}`);\n\t\t}\n\t}\n\treturn options;\n}\n\nfunction cloudClientFor(runtime: SlashCommandRuntime, credentialId?: number): CodexSecurityCloudClient {\n\tconst authStorage = runtime.session.modelRegistry.authStorage;\n\tconst account = selectSecurityAccount(authStorage, \"openai-codex\", credentialId, runtime.session.sessionId);","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/slash-commands/helpers/security.ts#L227-L263","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n/security cloud start --repo-id r1 --repo-url https://x --environment e1 --lookback 30d\n// after\n/security cloud start --repo-id r1 --repo-url https://x --environment e1 --lookback 30","handlingStrategy":"validation","validationCode":"const raw = \"30d\"; // value you plan to pass to --lookback\nconst valid = raw === \"all\" || (Number.isSafeInteger(Number(raw)) && Number(raw) >= 1);\nif (!valid) throw new Error(`Use \"all\" or a positive integer, got: ${raw}`);","typeGuard":"function isValidLookback(v: string): v is `${number}` | \"all\" {\n\treturn v === \"all\" || (Number.isSafeInteger(Number(v)) && Number(v) >= 1);\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","argument-parsing","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}