{"record":{"id":"cc2c5fa686dd403a","repo":"lobehub/lobehub","slug":"invalid-boolean-value-value","errorCode":null,"errorMessage":"Invalid boolean value: ${value}","messagePattern":"Invalid boolean value: (.+?)","errorType":"validation","errorClass":"InvalidArgumentError","httpStatus":null,"severity":"error","filePath":"apps/cli/src/commands/eval.ts","lineNumber":96,"sourceCode":"    log.error(normalized.message);\n  }\n\n  process.exit(1);\n};\n\nconst parseScore = (value: string) => {\n  const score = Number(value);\n  if (!Number.isFinite(score)) {\n    throw new InvalidArgumentError(`Invalid score: ${value}`);\n  }\n  return score;\n};\n\nconst parseBoolean = (value: string) => {\n  const normalized = value.trim().toLowerCase();\n  if (['1', 'true', 'yes'].includes(normalized)) return true;\n  if (['0', 'false', 'no'].includes(normalized)) return false;\n  throw new InvalidArgumentError(`Invalid boolean value: ${value}`);\n};\n\nconst parseResultJson = (value: string) => {\n  let parsed: unknown;\n  try {\n    parsed = JSON.parse(value);\n  } catch {\n    throw new InvalidArgumentError('Invalid JSON value for --result-json');\n  }\n\n  if (!isRecord(parsed) || Array.isArray(parsed)) {\n    throw new InvalidArgumentError('--result-json must be a JSON object');\n  }\n\n  return parsed;\n};\n\nconst parseJsonObject = (option: string) => (value: string) => {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/lobehub/lobehub/blob/10f24d7ade75139093a9373b364f6bc91f3cd7db/apps/cli/src/commands/eval.ts#L78-L114","documentation":"Thrown by parseBoolean when the --<flag> value (after trimming and lowercasing) is not one of the six accepted boolean strings: '1', 'true', 'yes' (for true) or '0', 'false', 'no' (for false). The CLI intentionally rejects ambiguous values like 'y', 'n', 'maybe', 'on', 'off' to avoid silent misinterpretation.","triggerScenarios":"Running an eval command with a boolean flag value that isn't in the accepted set. Examples: --verified 'y', --verified 'on', --verified 'maybe', --verified 't', --verified '' (empty).","commonSituations":"1) Using shorthand 'y'/'n' instead of 'yes'/'no'. 2) Using 'on'/'off' (common in other CLIs). 3) Using 't'/'f' or 'T'/'F'. 4) Empty string from an unset variable. 5) Non-English words.","solutions":["Use one of: 1, true, yes, 0, false, no (case-insensitive).","Avoid shorthand: use 'yes' instead of 'y', 'no' instead of 'n'.","If the value comes from a shell variable, normalize it: VAL=true && lh eval ... --flag \"$VAL\"."],"exampleFix":"// before:\n// lh eval report --verified y --run-id run-123\n// after:\n// lh eval report --verified yes --run-id run-123","handlingStrategy":"validation","validationCode":"const TRUE_VALUES = new Set(['1', 'true', 'yes']);\nconst FALSE_VALUES = new Set(['0', 'false', 'no']);\nfunction parseBooleanStrict(value: string): boolean {\n  const n = value.trim().toLowerCase();\n  if (TRUE_VALUES.has(n)) return true;\n  if (FALSE_VALUES.has(n)) return false;\n  throw new Error(`Invalid boolean: ${value}. Use one of: 1, true, yes, 0, false, no`);\n}","typeGuard":"function isAcceptedBoolean(value: string): boolean {\n  const n = value.trim().toLowerCase();\n  return ['1','true','yes','0','false','no'].includes(n);\n}","tryCatchPattern":null,"preventionTips":["Use the full words 'yes'/'no' or 'true'/'false' — not shorthand.","Avoid 'on'/'off', 'y'/'n', 't'/'f' — they are not accepted.","In scripts, normalize boolean variables to 'true'/'false' before passing."],"tags":["cli","validation","eval","boolean"],"backgroundTag":null,"analyzedSha":"10f24d7ade75139093a9373b364f6bc91f3cd7db","analyzedAt":"2026-08-12T11:43:19.543Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}