{"record":{"id":"fe782588f950f197","repo":"flxzt/rnote","slug":"expected-only-a-single-rnote-file-the-option-o","errorCode":null,"errorMessage":"Expected only a single rnote file. The option \"--output-format\" must be used when exporting multiple files.","messagePattern":"Expected only a single rnote file\\. The option \"--output-format\" must be used when exporting multiple files\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rnote-cli/src/export.rs","lineNumber":77,"sourceCode":"    )?;\n\n    match output_file {\n        Some(output_file) => {\n            let Some(rnote_file) = rnote_files.first() else {\n                return Err(anyhow::anyhow!(\n                    \"There must be at least one rnote file specified for exporting.\"\n                ));\n            };\n\n            validators::file_has_ext(rnote_file, \"rnote\")?;\n            let output_file = get_output_file_path(\n                output_file,\n                on_conflict,\n                &mut on_conflict_overwrite,\n                &export_command,\n            )?;\n            if rnote_files.len() > 1 {\n                return Err(anyhow::anyhow!(\n                    \"Expected only a single rnote file. The option \\\"--output-format\\\" must be used when exporting multiple files.\"\n                ));\n            }\n\n            let rnote_file_disp = rnote_file.display().to_string();\n            let output_file_disp = output_file.display().to_string();\n            let progressbar = cli::new_progressbar(format!(\n                \"Exporting \\\"{rnote_file_disp}\\\" to: \\\"{output_file_disp}\\\".\"\n            ));\n\n            if let Err(e) = export_to_file(\n                &mut engine,\n                rnote_file,\n                output_file,\n                &export_command,\n                on_conflict,\n                &mut on_conflict_overwrite,\n                open,","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-cli/src/export.rs#L59-L95","documentation":"When an explicit --output-file is provided, the export writes one input document to that single file. Exporting multiple rnote files therefore requires --output-format (which produces one output per input) instead; this error stops the ambiguous multi-input + single-output combination.","triggerScenarios":"`rnote export doc file1.rnote file2.rnote --output-file out.pdf` — output_file.is_some() and rnote_files.len() > 1.","commonSituations":"Batch exporting while keeping an --output-file flag from a previous single-file invocation; scripts parameterized with a fixed output file but variable input lists.","solutions":["Replace --output-file with --output-format (e.g. --output-format pdf) when passing multiple input files.","Pass only one .rnote file if you want to keep --output-file.","Adjust scripts to switch flag sets based on the number of input files."],"exampleFix":"// before\nrnote export doc a.rnote b.rnote --output-file out.pdf\n// after\nrnote export doc a.rnote b.rnote --output-format pdf","handlingStrategy":"validation","validationCode":"if [ \"$#\" -gt 1 ] && [[ \"$ARGS\" == *\"--output-file\"* ]]; then echo \"use --output-format for multiple inputs\"; exit 2; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Rule of thumb: --output-file for one file, --output-format for many.","Strip --output-file from flag templates when input count > 1.","Test scripts with both single and multiple inputs."],"tags":["cli","conflicting-options","multiple-files"],"backgroundTag":"mutually-exclusive-options","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"}