{"record":{"id":"6a4a3b5b3e41945e","repo":"shwenzhang/AndResGuard","slug":"unexpected-parameter-s-after-apk-params-1","errorCode":null,"errorMessage":"Unexpected parameter(s) after APK (<params[1]>)","messagePattern":"Unexpected parameter\\(s\\) after APK \\(<params\\[1\\]>\\)","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java","lineNumber":352,"sourceCode":"                                     + \". See --help for supported\"\n                                     + \" options.\");\n      }\n    }\n    params = optionsParser.getRemainingParams();\n\n    if (inputApk != null) {\n      // Input APK has been specified in preceding parameters. We don't expect any more\n      // parameters.\n      if (params.length > 0) {\n        throw new ParameterException(\"Unexpected parameter(s) after \" + optionOriginalForm + \": \" + params[0]);\n      }\n    } else {\n      // Input APK has not been specified in preceding parameters. The next parameter is\n      // supposed to be the input APK.\n      if (params.length < 1) {\n        throw new ParameterException(\"Missing APK\");\n      } else if (params.length > 1) {\n        throw new ParameterException(\"Unexpected parameter(s) after APK (\" + params[1] + \")\");\n      }\n      inputApk = new File(params[0]);\n    }\n\n    if ((minSdkVersionSpecified) && (maxSdkVersionSpecified) && (minSdkVersion > maxSdkVersion)) {\n      throw new ParameterException(\"Min API Level (\" + minSdkVersion + \") > max API Level (\" + maxSdkVersion + \")\");\n    }\n\n    ApkVerifier.Builder apkVerifierBuilder = new ApkVerifier.Builder(inputApk);\n    if (minSdkVersionSpecified) {\n      apkVerifierBuilder.setMinCheckedPlatformVersion(minSdkVersion);\n    }\n    if (maxSdkVersionSpecified) {\n      apkVerifierBuilder.setMaxCheckedPlatformVersion(maxSdkVersion);\n    }\n    ApkVerifier apkVerifier = apkVerifierBuilder.build();\n    ApkVerifier.Result result;\n    try {","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java#L334-L370","documentation":"When the input APK is given positionally (no --in), verify accepts exactly one positional argument. More than one leftover parameter is ambiguous, so the tool rejects the command naming the first extra parameter.","triggerScenarios":"Running `apksigner verify app.apk other.apk` or `apksigner verify app.apk --some-misplaced-flag` where a flag-like token isn't recognized as an option and lands in remaining params, making params.length > 1 at line 351.","commonSituations":"Trying to verify multiple APKs in one command (unsupported); passing extra arguments intended for a different subcommand; a typo or unquoted option that the OptionsParser treats as positional.","solutions":["Verify one APK per invocation; loop over files in a script instead.","Remove the extra positional argument, keeping only the APK path.","If an option was intended, check spelling against `apksigner verify --help` — unsupported options must go before the APK and be recognized flags."],"exampleFix":"// before\napksigner verify app.apk other.apk\n// after\napksigner verify app.apk && apksigner verify other.apk","handlingStrategy":"validation","validationCode":"// shell: verify one APK per invocation\nfor apk in \"$@\"; do\n  apksigner verify --in \"$apk\" || exit 1\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass multiple APKs to a single verify command","Put all flags before the APK argument and check flag spelling","Add shellcheck to scripts to catch unquoted/extra arguments"],"tags":["cli","argument-parsing","apksigner"],"backgroundTag":"invalid-cli-argument","analyzedSha":"e4df245d82f27d9a2d0dd108260a3510cbaba849","analyzedAt":"2026-09-12T17:49:07.798Z","contentChangedAt":"2026-09-12T17:49:07.798Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}