{"record":{"id":"1245375c1a2ddab0","repo":"sigoden/aichat","slug":"invalid-chunk-overlay","errorCode":null,"errorMessage":"Invalid chunk_overlay","messagePattern":"Invalid chunk_overlay","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/rag/mod.rs","lineNumber":917,"sourceCode":"    if let Some(help_message) = &help_message {\n        text = text.with_help_message(help_message);\n    }\n    let value = text.prompt()?;\n    value.parse().map_err(|_| anyhow!(\"Invalid chunk_size\"))\n}\n\nfn set_chunk_overlay(default_value: usize) -> Result<usize> {\n    let value = Text::new(\"Set chunk overlay:\")\n        .with_default(&default_value.to_string())\n        .with_validator(move |text: &str| {\n            let out = match text.parse::<usize>() {\n                Ok(_) => Validation::Valid,\n                Err(_) => Validation::Invalid(\"Must be a integer\".into()),\n            };\n            Ok(out)\n        })\n        .prompt()?;\n    value.parse().map_err(|_| anyhow!(\"Invalid chunk_overlay\"))\n}\n\nfn add_documents() -> Result<Vec<String>> {\n    let text = Text::new(\"Add documents:\")\n        .with_validator(required!(\"This field is required\"))\n        .with_help_message(\"e.g. file;dir/;dir/**/*.{md,mdx};loader:resource;url;website/**\")\n        .prompt()?;\n    let paths = text\n        .split(';')\n        .filter_map(|v| {\n            let v = v.trim().to_string();\n            if v.is_empty() {\n                None\n            } else {\n                Some(v)\n            }\n        })\n        .collect();","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/rag/mod.rs#L899-L935","documentation":"Error surfaced by the RAG setup prompt set_chunk_overlay when the entered text cannot be parsed as usize. The interactive validator normally rejects non-integers ('Must be a integer'), so this bail is the fallback for unparseable chunk overlay input during create_config.","triggerScenarios":"Entering non-numeric or otherwise unparsable text at the 'Set chunk overlay:' prompt during rag create_config.","commonSituations":"Typing a float or units ('0.2', '10%'); empty input slipping through; locale-formatted digits.","solutions":["Enter a plain non-negative integer, e.g. 100","Re-run setup and correct the value at the prompt","Set the overlay value directly in the RAG config file"],"exampleFix":"// at the prompt\n// before: chunk overlay: 10%\n// after:  chunk overlay: 10","handlingStrategy":"validation","validationCode":"fn valid_chunk_overlay(s: &str) -> bool { s.trim().parse::<usize>().is_ok() }","typeGuard":null,"tryCatchPattern":"let ov: usize = prompt_and_parse(\"chunk overlay\").map_err(|_| {\n    eprintln!(\"Chunk overlay must be a plain integer\"); retry()\n})?;","preventionTips":["Enter plain non-negative integers; no %, floats, or units","Keep overlay smaller than chunk size","Set both values directly in the RAG config for automation"],"tags":["cli","input-validation","rag"],"backgroundTag":"invalid-config-value","analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}