sigoden/aichat · warning
Aborted
Error message
Aborted
What it means
`sync_documents` in the RAG module aborts itself with `bail!("Aborted")` when the user answers 'No' to the interactive confirm prompt 'Some documents failed to load. Continue?'. It is an intentional, user-requested cancellation: not all documents could be loaded, and the user declined to proceed with a partial RAG sync. Callers like `refresh_document_paths` propagate this error up.
Solutions
- Check which documents failed to load (the loader errors printed before the prompt) and fix or remove them from the documents directory
- Answer 'Yes' at the prompt if a partial sync of the remaining documents is acceptable
- Verify file permissions and formats for all files in the configured RAG documents directory
- Run in an interactive terminal so the Confirm prompt can be answered deliberately
Example fix
// before: blindly refreshing and crashing on prompt decline
rag.refresh_document_paths()?;
// after: treat user-abort as non-fatal
match rag.refresh_document_paths() {
Err(e) if e.to_string() == "Aborted" => println!("Sync cancelled by user"),
other => other?,
} Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check all documents are loadable before sync
for path in &doc_paths {
if !path.exists() || std::fs::metadata(path).map(|m| m.is_file()).unwrap_or(false) == false {
eprintln!("Warning: document not readable: {}", path.display());
}
} Type guard
fn is_aborted(err: &anyhow::Error) -> bool {
err.to_string() == "Aborted"
} Try / catch
match rag.refresh_document_paths() {
Err(e) if e.to_string() == "Aborted" => println!("Sync cancelled"),
other => other?,
} Prevention
- Fix or remove failing documents before syncing
- Run in an interactive terminal so the confirm prompt is answerable
- Log which documents failed to load before deciding to continue
When it happens
Trigger: Calling sync_documents/refresh_document_paths while at least one document fails to load (unreadable file, parse error, unsupported format) triggers a Confirm dialog; answering No (or accepting the default false with Enter) sets `aborted = true` and throws this error.
Common situations: A file in the documents directory was deleted or renamed after being indexed; a file has permissions preventing reading; a document uses a format the loader cannot parse; running non-interactively where the default 'No' is accepted; CI environments where confirm prompts auto-decline.
Related errors
AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09).
Data as JSON: /api/errors/4b8a9668e53cd8d0.
Report an issue: GitHub.
Appendix: source
Thrown at src/rag/mod.rs:425
for local_path in local_paths {
index += 1;
println!("Load {local_path} [{index}/{total}]");
match load_file(&loaders, &local_path).await {
Ok(v) => loaded_documents.push(v),
Err(err) => handle_error(err, &mut has_error),
}
}
if has_error {
let mut aborted = true;
if *IS_STDOUT_TERMINAL && total > 0 {
let ans = Confirm::new("Some documents failed to load. Continue?")
.with_default(false)
.prompt()?;
aborted = !ans;
}
if aborted {
bail!("Aborted");
}
}
let mut rag_files = vec![];
for LoadedDocument {
path,
contents,
mut metadata,
} in loaded_documents
{
let hash = sha256(&contents);
if let Some(file_ids) = to_deleted.get_mut(&hash) {
if let Some((i, _)) = file_ids
.iter()
.enumerate()
.find(|(_, v)| self.data.files[*v].path == path)
{
if file_ids.len() == 1 {View on GitHub (pinned to 82976d349a)