sigoden/aichat · error · anyhow::Error
Invalid chunk_overlay
Error message
Invalid chunk_overlay
What it means
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.
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
Example fix
// at the prompt // before: chunk overlay: 10% // after: chunk overlay: 10
Defensive patterns
Strategy: validation
Validate before calling
fn valid_chunk_overlay(s: &str) -> bool { s.trim().parse::<usize>().is_ok() } Try / catch
let ov: usize = prompt_and_parse("chunk overlay").map_err(|_| {
eprintln!("Chunk overlay must be a plain integer"); retry()
})?; Prevention
- 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
When it happens
Trigger: Entering non-numeric or otherwise unparsable text at the 'Set chunk overlay:' prompt during rag create_config.
Common situations: Typing a float or units ('0.2', '10%'); empty input slipping through; locale-formatted digits.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09).
Data as JSON: /api/errors/1245375c1a2ddab0.
Report an issue: GitHub.
Appendix: source
Thrown at src/rag/mod.rs:917
if let Some(help_message) = &help_message {
text = text.with_help_message(help_message);
}
let value = text.prompt()?;
value.parse().map_err(|_| anyhow!("Invalid chunk_size"))
}
fn set_chunk_overlay(default_value: usize) -> Result<usize> {
let value = Text::new("Set chunk overlay:")
.with_default(&default_value.to_string())
.with_validator(move |text: &str| {
let out = match text.parse::<usize>() {
Ok(_) => Validation::Valid,
Err(_) => Validation::Invalid("Must be a integer".into()),
};
Ok(out)
})
.prompt()?;
value.parse().map_err(|_| anyhow!("Invalid chunk_overlay"))
}
fn add_documents() -> Result<Vec<String>> {
let text = Text::new("Add documents:")
.with_validator(required!("This field is required"))
.with_help_message("e.g. file;dir/;dir/**/*.{md,mdx};loader:resource;url;website/**")
.prompt()?;
let paths = text
.split(';')
.filter_map(|v| {
let v = v.trim().to_string();
if v.is_empty() {
None
} else {
Some(v)
}
})
.collect();View on GitHub (pinned to 82976d349a)