{"record":{"id":"662ab0ff43e7187d","repo":"flxzt/rnote","slug":"either-output-file-or-output-format-is-req","errorCode":null,"errorMessage":"Either \"--output-file\" or \"--output-format\" is required.","messagePattern":"Either \"--output-file\" or \"--output-format\" is required\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rnote-cli/src/export.rs","lineNumber":307,"sourceCode":"        (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        }\n    };\n\n    let prefs = DocExportPrefs {\n        export_format: format,\n        with_background: !no_background,\n        with_pattern: !no_pattern,\n        optimize_printing,\n        page_order,\n    };\n\n    Ok(prefs)\n}\n\nfn doc_export_format_from_ext_str(format: &str) -> anyhow::Result<DocExportFormat> {\n    match format {","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-cli/src/export.rs#L289-L325","documentation":"Doc export needs to know the target format, which must come from either --output-file or --output-format. clap marks one of them required; this (None, None) arm is the defensive fallback in create_doc_export_prefs_from_args that fires if neither is present despite the parse-time requirement.","triggerScenarios":"Invoking doc export with neither --output-file nor --output-format. Normally rejected by clap; reachable only if the required constraint is removed or the prefs function is called directly with both None.","commonSituations":"Scripts building the command dynamically and dropping both flags; direct calls to create_doc_export_prefs_from_args from other code with unset options.","solutions":["Add --output-format <svg|xopp|pdf> to the doc export command.","Or provide --output-file <path> with a supported extension.","If calling the function from code, ensure at least one of the two options is set."],"exampleFix":"// before\nrnote export doc notes.rnote\n// after\nrnote export doc notes.rnote --output-format pdf","handlingStrategy":"validation","validationCode":"case \"$ARGS\" in *--output-file*|*--output-format*) ;; *) echo \"doc export needs --output-file or --output-format\"; exit 2;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply --output-format (or --output-file) for doc export.","Check the subcommand's --help for required options.","Fail fast in scripts when required flags are missing."],"tags":["cli","missing-argument"],"backgroundTag":"missing-required-option","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"}