{"record":{"id":"e8eb69e7134d2141","repo":"tobi/qmd","slug":"chunk-strategy-must-be-auto-or-regex-got","errorCode":null,"errorMessage":"--chunk-strategy must be \"auto\" or \"regex\" (got \"${s}\")","messagePattern":"--chunk-strategy must be \"auto\" or \"regex\" \\(got \"(.+?)\"\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/qmd.ts","lineNumber":2100,"sourceCode":"  const empty = width - filled;\n  const bar = \"█\".repeat(filled) + \"░\".repeat(empty);\n  return bar;\n}\n\nfunction parseEmbedBatchOption(name: string, value: unknown): number | undefined {\n  if (value === undefined) return undefined;\n  const parsed = Number(value);\n  if (!Number.isInteger(parsed) || parsed < 1) {\n    throw new Error(`${name} must be a positive integer`);\n  }\n  return parsed;\n}\n\nfunction parseChunkStrategy(value: unknown): ChunkStrategy | undefined {\n  if (value === undefined) return undefined;\n  const s = String(value);\n  if (s === \"auto\" || s === \"regex\") return s;\n  throw new Error(`--chunk-strategy must be \"auto\" or \"regex\" (got \"${s}\")`);\n}\n\n// --timeout for `qmd embed`: a cap on the whole embed session, in minutes. Returns\n// the value in milliseconds, or undefined to use the default. 0 disables the cap.\nfunction parseEmbedTimeoutOption(value: unknown): number | undefined {\n  if (value === undefined) return undefined;\n  const minutes = Number(value);\n  if (!Number.isFinite(minutes) || minutes < 0) {\n    throw new Error(`--timeout must be a non-negative number of minutes (0 = no limit)`);\n  }\n  return minutes * 60 * 1000;\n}\n\nfunction ensureModelsConfiguredForCli(): { embed: string; generate: string; rerank: string } {\n  try {\n    const config = loadConfig();\n    const models = resolveModels(config.models);\n    const current = config.models ?? {};","sourceCodeStart":2082,"sourceCodeEnd":2118,"githubUrl":"https://github.com/tobi/qmd/blob/dbfd0b4736aeaf761d1a16ca8e424f071df8feb9/src/cli/qmd.ts#L2082-L2118","documentation":"Thrown by parseChunkStrategy when --chunk-strategy is given a value other than the two supported strategies: 'auto' (AST-aware chunking for code files) or 'regex' (default).","triggerScenarios":"Running `qmd collection add . --chunk-strategy ast` or `--chunk-strategy treesitter`; passing an empty string via a script variable.","commonSituations":"Guessing strategy names from other tools (ast, semantic, ts); older docs or muscle memory from versions before 'auto' existed; quoting mistakes leaving a stray space.","solutions":["Use `--chunk-strategy auto` or `--chunk-strategy regex`","Omit the flag to keep the default regex strategy","Check `qmd collection add --help` for the current accepted values"],"exampleFix":"# before\nqmd collection add . --name docs --chunk-strategy ast\n# after\nqmd collection add . --name docs --chunk-strategy auto","handlingStrategy":"type-guard","validationCode":"if (!['auto', 'regex'].includes(strategy)) throw new Error(`invalid chunk strategy ${strategy}`);","typeGuard":"const isChunkStrategy = (v: unknown): v is 'auto' | 'regex' => v === 'auto' || v === 'regex';","tryCatchPattern":null,"preventionTips":["Check qmd collection add --help for accepted enum values before scripting"],"tags":["cli","chunking","option-validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"dbfd0b4736aeaf761d1a16ca8e424f071df8feb9","analyzedAt":"2026-08-28T18:07:46.628Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}