janhq/jan · error · RagError
UnsupportedFileType
UnsupportedFileType
Error message
Unsupported file type: {0} What it means
RagError::UnsupportedFileType is raised when the RAG plugin is asked to ingest a document whose file type/extension is not among the supported parsers (displayed as "Unsupported file type: {0}" with the offending type). The plugin intentionally rejects unknown formats instead of guessing.
Solutions
- Check the file extension/MIME type against the plugin's supported list before calling ingest.
- Convert the document to a supported format (e.g. export .docx to PDF or plain text) first.
- Filter or skip unsupported files during batch ingestion with a clear user notice.
- Extend the plugin's parser set if a new format is genuinely required.
Example fix
// before: blind ingest
for f in files { rag.ingest(f)?; }
// after
const SUPPORTED: [&str; 2] = ["pdf", "txt"];
for f in files {
let ext = f.extension().and_then(|e| e.to_str()).unwrap_or("");
if !SUPPORTED.contains(&ext) {
eprintln!("skipping {f:?}: unsupported type .{ext}");
continue;
}
rag.ingest(f)?;
} Defensive patterns
Strategy: validation
Validate before calling
// Rust: check extension against supported set before ingest
fn is_supported(path: &Path) -> bool {
matches!(path.extension().and_then(|e| e.to_str()), Some("pdf") | Some("txt"))
} Type guard
fn as_unsupported_type(err: &RagError) -> Option<&str> {
match err { RagError::UnsupportedFileType(t) => Some(t), _ => None }
} Try / catch
match rag.ingest(file) {
Err(RagError::UnsupportedFileType(t)) => {
notify_user(format!(".{t} files are not supported; convert to PDF or TXT"));
}
other => other?,
} Prevention
- Filter uploads by extension/MIME at the UI layer before they reach the plugin.
- Show users the list of accepted formats up front.
- Convert unsupported documents (docx, etc.) to supported formats during import.
- Ignore disguised extensions — verify actual file signatures when possible.
When it happens
Trigger: Calling the RAG ingest API with files like .docx, .xlsx, images, or arbitrary binaries when only formats such as .pdf/.txt are supported.
Common situations: Users dropping unsupported files into an upload UI; batch-importing a folder containing mixed file types; filename extensions changed to disguise binary content.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/d727972133f1ba05.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/plugins/tauri-plugin-rag/src/error.rs:8
use serde::{Deserialize, Serialize};
#[derive(Debug, thiserror::Error, Serialize, Deserialize)]
pub enum RagError {
#[error("Failed to parse document: {0}")]
ParseError(String),
#[error("Unsupported file type: {0}")]
UnsupportedFileType(String),
#[error("IO error: {0}")]
IoError(String),
}
impl From<std::io::Error> for RagError {
fn from(err: std::io::Error) -> Self {
RagError::IoError(err.to_string())
}
}
View on GitHub (pinned to 7205d770c1)