{"record":{"id":"bb32ea5d01009d51","repo":"shwenzhang/AndResGuard","slug":"valuedescription-missing-after-mlastoptionoriginalform","errorCode":null,"errorMessage":"<valueDescription> missing after <mLastOptionOriginalForm>","messagePattern":"<valueDescription> missing after <mLastOptionOriginalForm>","errorType":"validation","errorClass":"OptionsException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/OptionsParser.java","lineNumber":108,"sourceCode":"   * Returns the original form of the current option. The original form includes the leading dash\n   * or dashes. This is intended to be used for referencing the option in error messages.\n   */\n  public String getOptionOriginalForm() {\n    return mLastOptionOriginalForm;\n  }\n\n  /**\n   * Returns the value of the current option, throwing an exception if the value is missing.\n   */\n  public String getRequiredValue(String valueDescription) throws OptionsException {\n    if (mLastOptionValue != null) {\n      String result = mLastOptionValue;\n      mLastOptionValue = null;\n      return result;\n    }\n    if (mIndex >= mParams.length) {\n      // No more parameters left\n      throw new OptionsException(valueDescription + \" missing after \" + mLastOptionOriginalForm);\n    }\n    String param = mParams[mIndex];\n    if (\"--\".equals(param)) {\n      // End of options marker\n      throw new OptionsException(valueDescription + \" missing after \" + mLastOptionOriginalForm);\n    }\n    mIndex++;\n    return param;\n  }\n\n  /**\n   * Returns the value of the current numeric option, throwing an exception if the value is\n   * missing or is not numeric.\n   */\n  public int getRequiredIntValue(String valueDescription) throws OptionsException {\n    String value = getRequiredValue(valueDescription);\n    try {\n      return Integer.parseInt(value);","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/OptionsParser.java#L90-L126","documentation":"The option parser consumed a flag that requires a value (e.g. --ks or --out) but ran out of command-line parameters, so the mandatory value was never supplied. It throws OptionsException naming the option's original form. This is a command-line usage error, not a runtime failure.","triggerScenarios":"Invoking apksigner with a value-taking option as the last argument (e.g. `apksigner sign --ks my.keystore`), or passing `--` immediately after an option that still needs its value (`apksigner sign --ks -- ...`).","commonSituations":"Truncated copy-pasted commands; shell scripts where a variable holding the value expands to empty (`--ks $KS` with KS unset); accidentally placing the `--` end-of-options marker too early.","solutions":["Append the missing value right after the option: `apksigner sign --ks my-release.keystore ...`.","In scripts, verify the variable holding the value is non-empty before invoking apksigner.","Reorder arguments so `--` appears only after all option/value pairs.","Run `apksigner sign --help` to check which options require values."],"exampleFix":"// before (KS variable empty)\napksigner sign --ks $KS --ks-key-alias release ...\n// after\n: \"${KS:?KS path not set}\"\napksigner sign --ks \"$KS\" --ks-key-alias release ...","handlingStrategy":"validation","validationCode":"static void requireArgs(String[] args) {\n  java.util.Set<String> valueOptions = java.util.Set.of(\n      \"--ks\", \"--ks-key-alias\", \"--ks-pass\", \"--key-pass\", \"--key\", \"--cert\",\n      \"--out\", \"--in\", \"--min-sdk-version\", \"--max-sdk-version\");\n  for (int i = 0; i < args.length; i++) {\n    if (\"--\".equals(args[i])) break;\n    if (valueOptions.contains(args[i]) && (i + 1 >= args.length || \"--\".equals(args[i + 1]))) {\n      throw new IllegalArgumentException(\"Missing value for option \" + args[i]);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  apksignerSign(args);\n} catch (OptionsException e) {\n  System.err.println(\"Usage error: \" + e.getMessage());\n  System.err.println(\"Run 'apksigner sign --help' for the full option list.\");\n  System.exit(2);\n}","preventionTips":["Quote variables in shell scripts and fail fast on unset ones: \": \\\"${KS:?not set}\\\"\".","Never place `--` before an option's value.","Copy-paste full commands, including trailing values.","Add a pre-flight arg check in wrapper scripts before invoking apksigner.","Consult `apksigner sign --help` to confirm which options take values."],"tags":["cli","options-parsing","missing-argument","apksigner"],"backgroundTag":"missing-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"}