sigoden/aichat · warning
No changes
Error message
No changes
What it means
Thrown by `GlobalConfig::edit_rag_docs` in src/config/mod.rs:1402 after the user edits the temporary document-list file, when the resulting `new_document_paths` list is empty or identical to the existing `document_paths`. The library refuses to refresh the RAG index because there is nothing to change, treating a no-op edit as an error so callers don't silently re-embed unchanged data.
Solutions
- Add, remove, or modify at least one document path in the temp file before saving
- If inspection was the goal, exit the editor without saving (or abort the command)
- Programmatically pass a genuinely different document list to `rag.refresh_document_paths` instead of relying on the editor flow
Example fix
// before (unchanged list triggers the error)
rag.refresh_document_paths(&document_paths, false, config, signal).await?;
// after: verify the change first
if new_paths.is_empty() || new_paths == old_paths {
return Ok(()); // treat as no-op instead of erroring
}
rag.refresh_document_paths(&new_paths, false, config, signal).await?; Defensive patterns
Strategy: validation
Validate before calling
let new_paths: Vec<String> = read_edited_list();
if new_paths.is_empty() || new_paths == old_paths {
eprintln!("No changes made to the document list; nothing to refresh");
return Ok(());
} Try / catch
if let Err(e) = config.edit_rag_docs(signal).await {
if e.to_string() == "No changes" {
return Ok(()); // treat as benign no-op
}
return Err(e.into());
} Prevention
- Instruct users to actually modify the doc list or abort without saving
- Disable format-on-save for the temp doc-list file so content stays identical when unedited
- Compare lists programmatically before refreshing
When it happens
Trigger: Opening the temp file in the editor and saving without modifications; deleting every line before saving; an editor wrapper that writes the same content back (e.g. format-on-save producing identical paths).
Common situations: Users who open the doc-list just to inspect it and save; editors or scripts that touch the file without changing content; accidentally clearing the file.
Related errors
AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09).
Data as JSON: /api/errors/c1799c007a8a0d00.
Report an issue: GitHub.
Appendix: source
Thrown at src/config/mod.rs:1402
.with_context(|| format!("Failed to write to '{}'", temp_file.display()))?;
let editor = config.read().editor()?;
edit_file(&editor, &temp_file)?;
let new_document_paths = tokio::fs::read_to_string(&temp_file)
.await
.with_context(|| format!("Failed to read '{}'", temp_file.display()))?;
let new_document_paths = new_document_paths
.split('\n')
.filter_map(|v| {
let v = v.trim();
if v.is_empty() {
None
} else {
Some(v.to_string())
}
})
.collect::<Vec<_>>();
if new_document_paths.is_empty() || new_document_paths == document_paths {
bail!("No changes")
}
rag.refresh_document_paths(&new_document_paths, false, config, abort_signal)
.await?;
config.write().rag = Some(Arc::new(rag));
Ok(())
}
pub async fn rebuild_rag(config: &GlobalConfig, abort_signal: AbortSignal) -> Result<()> {
let mut rag = match config.read().rag.clone() {
Some(v) => v.as_ref().clone(),
None => bail!("No RAG"),
};
let document_paths = rag.document_paths().to_vec();
rag.refresh_document_paths(&document_paths, true, config, abort_signal)
.await?;
config.write().rag = Some(Arc::new(rag));
Ok(())
}View on GitHub (pinned to 82976d349a)