flxzt/rnote · warning
Tried to open unsupported file type
Error message
Tried to open unsupported file type
What it means
FileType::lookup_file_type classifies the input file by extension/content. If it yields FileType::Unsupported, try_open_file explicitly returns this error because the file dispatcher has no branch to handle it.
Solutions
- Check the extension against the supported list (rnote/xopp/svg/pdf/images/text) before invoking open; only register supported types as handlers in the desktop file.
- Convert unsupported formats externally first (e.g. xopp-to-rnote converters, export PDF/images to supported types).
- In the app, replace the raw error with a user dialog listing supported formats so the failure is actionable.
- If the file actually is supported but misdetected, verify the extension or fix FileType::lookup_file_type detection.
Example fix
// before
FileType::Unsupported => {
return Err(anyhow::anyhow!("Tried to open unsupported file type"));
}
// after
FileType::Unsupported => {
dialogs::app::dialog_message(
self,
&gettext("Unsupported file"),
&gettext("Supported: .rnote, .xopp, .svg, images, PDF, text."),
);
return Ok(false);
} Defensive patterns
Strategy: validation
Validate before calling
// rust
let ft = FileType::lookup_file_type(&file);
if matches!(ft, FileType::Unsupported) {
eprintln!("{:?} is not a supported type (rnote/xopp/svg/images/pdf/text/folder)", file.uri());
}
// shell
case "${file##*.}" in rnote|xopp|svg|png|jpg|jpeg|pdf|txt|md) ;; *) echo unsupported ;; esac Type guard
fn is_supported(f: &gio::File) -> bool { !matches!(FileType::lookup_file_type(f), FileType::Unsupported) } Try / catch
match appwindow.try_open_file(&file, pos, new_tab).await {
Ok(v) => v,
Err(e) if e.to_string().contains("unsupported file type") => {
dialogs::app::dialog_message(&appwindow, &gettext("Unsupported"), &e.to_string());
false
}
Err(e) => return Err(e),
} Prevention
- Register only supported MIME types in the desktop file associations
- Pre-screen extensions in CLI/URI open paths before dispatching
- Present a supported-formats list in the error dialog instead of a raw message
- Keep FileType::lookup_file_type mappings in sync with newly supported formats
When it happens
Trigger: open_file_w_dialogs -> try_open_file with a file whose type detection resolves to FileType::Unsupported — any path not matching .rnote, xopp, vector image, bitmap image, PDF, plaintext, or folder extensions.
Common situations: Associating arbitrary file types with rnote in the OS and double-clicking them; passing a binary or unknown extension via CLI; opening files with wrong/missing extensions (e.g. .zip) expecting import.
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
- Failed to get filename from rnote_file
- Creating Pdf instance failed, Err
- no page at index
- Stroke has empty widths vector.
- Could not generate pen path from coordinates vector
AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08).
Data as JSON: /api/errors/b709f374fbe54574.
Report an issue: GitHub.
Appendix: source
Thrown at crates/rnote-ui/src/appwindow/mod.rs:702
let canvas = self
.active_tab_wrapper()
.ok_or_else(|| anyhow::anyhow!("No active tab to import into"))?
.canvas();
let (bytes, _) = input_file.load_bytes_future().await?;
canvas.load_in_text(String::from_utf8(bytes.to_vec())?, target_pos)?;
true
}
FileType::Folder => {
if let Some(dir) = input_file.path() {
self.sidebar()
.workspacebrowser()
.workspacesbar()
.set_selected_workspace_dir(dir);
}
false
}
FileType::Unsupported => {
return Err(anyhow::anyhow!("Tried to open unsupported file type"));
}
};
Ok(file_imported)
}
/// Refresh the UI from the global state and from the current active tab page.
pub(crate) fn refresh_ui(&self) {
let canvas = self.active_tab_canvas();
self.overlays().penssidebar().brush_page().refresh_ui(self);
self.overlays().penssidebar().shaper_page().refresh_ui(self);
self.overlays()
.penssidebar()
.typewriter_page()
.refresh_ui(self);
self.overlays().penssidebar().eraser_page().refresh_ui(self);
self.overlays()View on GitHub (pinned to bbc5354502)