{"record":{"id":"d5d5c217b0761502","repo":"shwenzhang/AndResGuard","slug":"missing-apk","errorCode":null,"errorMessage":"Missing APK","messagePattern":"Missing APK","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java","lineNumber":350,"sourceCode":"        throw new ParameterException(\"Unsupported option: \"\n                                     + optionOriginalForm\n                                     + \". 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();","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java#L332-L368","documentation":"The verify command could not find an input APK: neither --in was given nor was any positional argument left after option parsing, so there is no APK to verify. The tool throws rather than guessing a default file.","triggerScenarios":"Running `apksigner verify` with no APK argument and no --in option, e.g. invoking the command from a script where a variable holding the APK path expanded to empty (`apksigner verify $APK` with APK unset).","commonSituations":"CI scripts where an env var or build output path is empty; forgetting the APK argument entirely; accidentally quoting away the argument so the shell drops it.","solutions":["Pass the APK: `apksigner verify --in path/to/app.apk` or `apksigner verify path/to/app.apk`.","Check that the variable holding the APK path is set and non-empty before invoking.","Verify the file path is correct; note this error is about the missing argument, not file existence."],"exampleFix":"// before (shell)\napksigner verify $APK   # APK is unset\n// after\n[ -n \"$APK\" ] && apksigner verify --in \"$APK\"","handlingStrategy":"validation","validationCode":"// shell: fail fast when APK path is unset/empty\nAPK=${APK:?\"APK path is empty\"}\n[ -f \"$APK\" ] || { echo \"APK not found: $APK\" >&2; exit 1; }\napksigner verify --in \"$APK\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use ${VAR:?} guards for required path variables in CI scripts","Always pass --in explicitly rather than relying on positional args","Echo the final command before running in pipelines to catch empty expansions"],"tags":["cli","missing-argument","apksigner"],"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"}