flxzt/rnote · error

The output file " " needs to have a supported extension to…

Error message

The output file "{}" needs to have a supported extension to determine its file type.

What it means

When exporting a document with only --output-file (no --output-format), the export format is inferred from the output file's extension via doc_export_format_from_ext_str. If the path has no extension at all, the format cannot be determined, so this error is thrown naming the offending path.

Solutions

  1. Add a supported extension to the output file: .svg, .xopp, or .pdf.
  2. Alternatively pass --output-format explicitly instead of relying on the extension.
  3. If generating paths in a script, ensure the format suffix is appended.

Example fix

// before
rnote export doc notes.rnote --output-file out
// after
rnote export doc notes.rnote --output-file out.pdf
Defensive patterns

Strategy: validation

Validate before calling

case "$OUT" in *.svg|*.xopp|*.pdf) ;; *) echo "$OUT: missing/unsupported extension"; exit 2;; esac

Prevention

When it happens

Trigger: `rnote export doc notes.rnote --output-file out` — output_file has Some(path) but Path::extension() is None (no dot-extension).

Common situations: Omitting the extension on the output filename (out instead of out.pdf); paths built programmatically where the extension got lost; a trailing dot path like `out.` is also handled by the sibling unsupported-extension error, not this one.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of flxzt/rnote@bbc5354502 (2026-09-08). Data as JSON: /api/errors/b3c71482d48ea56e. Report an issue: GitHub.

Appendix: source

Thrown at crates/rnote-cli/src/export.rs:292

            .selection_export_prefs
            .export_format
            .file_ext(),
    }
}

pub(crate) fn create_doc_export_prefs_from_args(
    output_file: Option<impl AsRef<Path>>,
    output_format: Option<DocExportFormat>,
    no_background: bool,
    no_pattern: bool,
    optimize_printing: bool,
    page_order: SplitOrder,
) -> anyhow::Result<DocExportPrefs> {
    let format = match (output_file, output_format) {
        (Some(file), None) => match file.as_ref().extension().and_then(|ext| ext.to_str()) {
            Some(extension) => doc_export_format_from_ext_str(extension)?,
            None => {
                return Err(anyhow::anyhow!(
                    "The output file \"{}\" needs to have a supported extension to determine its file type.",
                    file.as_ref().display()
                ));
            }
        },
        (None, Some(out_format)) => out_format,
        // should be unreachable because the arguments are exclusive (clap conflicts_with)
        (Some(_), Some(_)) => {
            return Err(anyhow::anyhow!(
                "\"--output-file\" and \"--output-format\" are mutually exclusive."
            ));
        }
        // should be unreachable because either --output-file or --output-format is required
        (None, None) => {
            return Err(anyhow::anyhow!(
                "Either \"--output-file\" or \"--output-format\" is required."
            ));
        }

View on GitHub (pinned to bbc5354502)