{"record":{"id":"712e8ba6439bc975","repo":"actualbudget/actual","slug":"invalid-flagname-value-expected-true-o","errorCode":null,"errorMessage":"Invalid ${flagName}: \"${value}\". Expected \"true\" or \"false\".","messagePattern":"Invalid (.+?): \"(.+?)\"\\. Expected \"true\" or \"false\"\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/utils.ts","lineNumber":7,"sourceCode":"export function isRecord(value: unknown): value is Record<string, unknown> {\n  return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function parseBoolFlag(value: string, flagName: string): boolean {\n  if (value !== 'true' && value !== 'false') {\n    throw new Error(\n      `Invalid ${flagName}: \"${value}\". Expected \"true\" or \"false\".`,\n    );\n  }\n  return value === 'true';\n}\n\nexport function parseIntFlag(value: string, flagName: string): number {\n  const parsed = value.trim() === '' ? NaN : Number(value);\n  if (!Number.isInteger(parsed)) {\n    throw new Error(`Invalid ${flagName}: \"${value}\". Expected an integer.`);\n  }\n  return parsed;\n}\n\nexport function parseNonNegativeIntFlag(\n  value: string,\n  flagName: string,\n): number {","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/cli/src/utils.ts#L1-L25","documentation":"parseBoolFlag strictly validates that a CLI flag string is exactly \"true\" or \"false\". Any other string throws this error rather than coercing, so flags behave predictably.","triggerScenarios":"Calling parseBoolFlag with values like \"True\", \"1\", \"yes\", or \" true\" (whitespace) from commands registered by registerAccountsCommand, registerCategoriesCommand, registerCategoryGroupsCommand, or the flag helper.","commonSituations":"Users passing --closed=1 or --closed=yes on the CLI; shell scripts quoting values oddly; case sensitivity mistakes.","solutions":["Pass exactly \"true\" or \"false\" as the flag value.","Use bare boolean flags (e.g. --closed) instead of value forms if supported.","Normalize input before calling, e.g. value.trim().toLowerCase(), if you control the caller."],"exampleFix":"// before\nactual-cli accounts --closed=1\n// after\nactual-cli accounts --closed=true","handlingStrategy":"validation","validationCode":"function isValidBoolFlag(value: string): boolean {\n  return value === 'true' || value === 'false';\n}","typeGuard":null,"tryCatchPattern":"let closed: boolean;\ntry {\n  closed = parseBoolFlag(value, '--closed');\n} catch (err) {\n  console.error((err as Error).message);\n  process.exit(1);\n}","preventionTips":["Document flags as accepting only \"true\"/\"false\" in help text.","Normalize user input (trim + toLowerCase) before invoking CLI commands in scripts.","Prefer bare boolean flags over explicit \"=true/=false\" values.","Validate flag values in shell scripts before invoking the CLI."],"tags":["cli","validation","argument-parsing"],"backgroundTag":"invalid-argument-value","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}