{"record":{"id":"b3c71482d48ea56e","repo":"flxzt/rnote","slug":"the-output-file-needs-to-have-a-supported-ext","errorCode":null,"errorMessage":"The output file \"{}\" needs to have a supported extension to determine its file type.","messagePattern":"The output file \"(.+?)\" needs to have a supported extension to determine its file type\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rnote-cli/src/export.rs","lineNumber":292,"sourceCode":"            .selection_export_prefs\n            .export_format\n            .file_ext(),\n    }\n}\n\npub(crate) fn create_doc_export_prefs_from_args(\n    output_file: Option<impl AsRef<Path>>,\n    output_format: Option<DocExportFormat>,\n    no_background: bool,\n    no_pattern: bool,\n    optimize_printing: bool,\n    page_order: SplitOrder,\n) -> anyhow::Result<DocExportPrefs> {\n    let format = match (output_file, output_format) {\n        (Some(file), None) => match file.as_ref().extension().and_then(|ext| ext.to_str()) {\n            Some(extension) => doc_export_format_from_ext_str(extension)?,\n            None => {\n                return Err(anyhow::anyhow!(\n                    \"The output file \\\"{}\\\" needs to have a supported extension to determine its file type.\",\n                    file.as_ref().display()\n                ));\n            }\n        },\n        (None, Some(out_format)) => out_format,\n        // should be unreachable because the arguments are exclusive (clap conflicts_with)\n        (Some(_), Some(_)) => {\n            return Err(anyhow::anyhow!(\n                \"\\\"--output-file\\\" and \\\"--output-format\\\" are mutually exclusive.\"\n            ));\n        }\n        // should be unreachable because either --output-file or --output-format is required\n        (None, None) => {\n            return Err(anyhow::anyhow!(\n                \"Either \\\"--output-file\\\" or \\\"--output-format\\\" is required.\"\n            ));\n        }","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-cli/src/export.rs#L274-L310","documentation":"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.","triggerScenarios":"`rnote export doc notes.rnote --output-file out` — output_file has Some(path) but Path::extension() is None (no dot-extension).","commonSituations":"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.","solutions":["Add a supported extension to the output file: .svg, .xopp, or .pdf.","Alternatively pass --output-format explicitly instead of relying on the extension.","If generating paths in a script, ensure the format suffix is appended."],"exampleFix":"// before\nrnote export doc notes.rnote --output-file out\n// after\nrnote export doc notes.rnote --output-file out.pdf","handlingStrategy":"validation","validationCode":"case \"$OUT\" in *.svg|*.xopp|*.pdf) ;; *) echo \"$OUT: missing/unsupported extension\"; exit 2;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include .svg, .xopp or .pdf on doc export output paths.","Or pass --output-format explicitly and skip extension inference.","Sanitize programmatically generated output paths to end with a known extension."],"tags":["cli","file-extension","export"],"backgroundTag":"invalid-argument-format","analyzedSha":"bbc5354502ba2fc83eec2670b535348825e679a6","analyzedAt":"2026-09-08T13:20:33.747Z","contentChangedAt":"2026-09-08T13:20:33.747Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}