{"record":{"id":"1ae49c65e02483be","repo":"shwenzhang/AndResGuard","slug":"missing-input-apk","errorCode":null,"errorMessage":"Missing input APK","messagePattern":"Missing input APK","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java","lineNumber":204,"sourceCode":"    }\n    signerParams = null;\n\n    if (signers.isEmpty()) {\n      throw new ParameterException(\"At least one signer must be specified\");\n    }\n\n    params = optionsParser.getRemainingParams();\n    if (inputApk != null) {\n      // Input APK has been specified via 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 via preceding parameters. The next parameter is\n      // supposed to be the path to input APK.\n      if (params.length < 1) {\n        throw new ParameterException(\"Missing input APK\");\n      } else if (params.length > 1) {\n        throw new ParameterException(\"Unexpected parameter(s) after input APK (\" + params[1] + \")\");\n      }\n      inputApk = new File(params[0]);\n    }\n    if ((minSdkVersionSpecified) && (minSdkVersion > maxSdkVersion)) {\n      throw new ParameterException(\"Min API Level (\" + minSdkVersion + \") > max API Level (\" + maxSdkVersion + \")\");\n    }\n\n    List<ApkSigner.SignerConfig> signerConfigs = new ArrayList<>(signers.size());\n    int signerNumber = 0;\n    try (PasswordRetriever passwordRetriever = new PasswordRetriever()) {\n      for (SignerParams signer : signers) {\n        signerNumber++;\n        signer.name = \"signer #\" + signerNumber;\n        try {\n          signer.loadPrivateKeyAndCerts(passwordRetriever);\n        } catch (ParameterException e) {","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java#L186-L222","documentation":"Validation guard in ApkSignerTool.sign: neither --in/--input was given nor a positional APK path remains, so the tool has no APK to sign. Fires when apksigner is invoked with signer options but the input APK argument is missing entirely, e.g. 'apksigner sign --ks keystore.jks' with no APK.","triggerScenarios":"`apksigner sign --ks ks.jks --out out.apk` with neither --in nor a positional APK path; or a variable holding the APK path expanding to empty in a script.","commonSituations":"Shell scripts where $APK is unset/empty; forgetting the input file entirely; reordering arguments so the path was consumed as an option value.","solutions":["Pass the APK path positionally: `apksigner sign --ks ks.jks app.apk`","Or add --in app.apk","In scripts, guard: `[ -f \"$APK\" ] || exit 1` before invoking"],"exampleFix":"// before\napksigner sign --ks ks.jks --out app-signed.apk\n// after\napksigner sign --ks ks.jks --out app-signed.apk app.apk","handlingStrategy":"validation","validationCode":"if (!Arrays.asList(args).contains(\"--in\") && positionalArgs(args).length == 0) throw new IllegalArgumentException(\"Input APK path required\");","typeGuard":null,"tryCatchPattern":"try { signCmd(args); } catch (ParameterException e) { System.err.println(\"Missing input APK: \" + e.getMessage()); exit(1); }","preventionTips":["Always supply the APK via --in or as the single positional arg","Check that the APK path variable is non-empty before invoking","Verify the path exists: [ -f \"$APK\" ]"],"tags":["cli","missing-argument"],"backgroundTag":"missing-required-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"}