{"record":{"id":"cc5d3ce7177dfe4b","repo":"clap-rs/clap","slug":"command-argument-has-the-same-index-as","errorCode":null,"errorMessage":"Command {}: Argument '{}' has the same index as '{}' and they are both positional arguments\n\n\t Use `Arg::num_args(1..)` to allow one positional argument to take multiple values","messagePattern":"Command (.+?): Argument '(.+?)' has the same index as '(.+?)' and they are both positional arguments\n\n\t Use `Arg::num_args\\(1\\.\\.\\)` to allow one positional argument to take multiple values","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clap_builder/src/builder/debug_asserts.rs","lineNumber":142,"sourceCode":"            if let Some((first, second)) = cmd.two_args_of(|x| x.get_short() == Some(s)) {\n                panic!(\n                    \"Command {}: Short option names must be unique for each argument, \\\n                            but '-{}' is in use by both '{}' and '{}'{}\",\n                    cmd.get_name(),\n                    s,\n                    first.get_id(),\n                    second.get_id(),\n                    duplicate_tip(cmd, first, second),\n                )\n            }\n        }\n\n        // Index conflicts\n        if let Some(idx) = arg.index {\n            if let Some((first, second)) =\n                cmd.two_args_of(|x| x.is_positional() && x.get_index() == Some(idx))\n            {\n                panic!(\n                    \"Command {}: Argument '{}' has the same index as '{}' \\\n                    and they are both positional arguments\\n\\n\\t \\\n                    Use `Arg::num_args(1..)` to allow one \\\n                    positional argument to take multiple values\",\n                    cmd.get_name(),\n                    first.get_id(),\n                    second.get_id()\n                )\n            }\n        }\n\n        // requires, r_if, r_unless\n        for (_predicate, req_id) in &arg.requires {\n            assert!(\n                &arg.id != req_id,\n                \"Argument {} cannot require itself\",\n                arg.get_id()\n            );","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/clap-rs/clap/blob/5b81f1012da19f1474decfe7ffcfb437f59ccba4/clap_builder/src/builder/debug_asserts.rs#L124-L160","documentation":"Error \"Command {}: Argument '{}' has the same index as '{}' and they are both positional arguments\n\n\t Use `Arg::num_args(1..)` to allow one positional argument to take multiple values\" thrown in clap-rs/clap.","triggerScenarios":"Thrown at clap_builder/src/builder/debug_asserts.rs:142 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5b81f1012da19f1474decfe7ffcfb437f59ccba4","analyzedAt":"2026-08-18T23:51:45.477Z","contentChangedAt":"2026-08-18T23:51:45.477Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}