{"record":{"id":"8ae5d395bddfab1e","repo":"shwenzhang/AndResGuard","slug":"unsupported-value-for-mlastoptionoriginalform-stringvalue","errorCode":null,"errorMessage":"Unsupported value for <mLastOptionOriginalForm>: <stringValue>. Only true or false supported.","messagePattern":"Unsupported value for <mLastOptionOriginalForm>: <stringValue>\\. Only true or false supported\\.","errorType":"validation","errorClass":"OptionsException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/OptionsParser.java","lineNumber":150,"sourceCode":"                                 + value);\n    }\n  }\n\n  /**\n   * Gets the value of the current boolean option. Boolean options are not required to have\n   * explicitly specified values.\n   */\n  public boolean getOptionalBooleanValue(boolean defaultValue) throws OptionsException {\n    if (mLastOptionValue != null) {\n      // --option=value form\n      String stringValue = mLastOptionValue;\n      mLastOptionValue = null;\n      if (\"true\".equals(stringValue)) {\n        return true;\n      } else if (\"false\".equals(stringValue)) {\n        return false;\n      }\n      throw new OptionsException(\"Unsupported value for \"\n                                 + mLastOptionOriginalForm\n                                 + \": \"\n                                 + stringValue\n                                 + \". Only true or false supported.\");\n    }\n\n    // --option (true|false) form OR just --option\n    if (mIndex >= mParams.length) {\n      return defaultValue;\n    }\n\n    String stringValue = mParams[mIndex];\n    if (\"true\".equals(stringValue)) {\n      mIndex++;\n      return true;\n    } else if (\"false\".equals(stringValue)) {\n      mIndex++;\n      return false;","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/OptionsParser.java#L132-L168","documentation":"A boolean-valued option was given something other than the literal strings \"true\" or \"false\". The parser only accepts exact lowercase matches and rejects everything else — including \"True\", \"1\", \"0\", \"yes\", or an empty string — with an OptionsException listing the accepted values.","triggerScenarios":"Passing `--v2-signing-enabled True`, `--v1-signing-enabled 1`, `--enabled yes`, or an empty value (`--v3-signing-enabled` followed by nothing/expanding to empty) to a boolean option such as --v1-signing-enabled, --v2-signing-enabled, or --v3-signing-enabled.","commonSituations":"Shell variables holding \"1\"/\"0\" from CI configs; capitalized booleans from other tools' conventions; YAML/env-style \"yes\"/\"no\" values; a variable expanding to empty because the feature flag was unset.","solutions":["Use the exact lowercase literals: `--v2-signing-enabled true` or `--v2-signing-enabled false`.","Normalize values in scripts: lowercase and map 1/0 or yes/no to true/false before invoking apksigner.","Ensure the variable providing the value is set and non-empty.","Omit the option entirely if you want the default behavior instead of guessing a value."],"exampleFix":"// before\napksigner sign --v2-signing-enabled True --out app.apk in.apk\n// after\napksigner sign --v2-signing-enabled true --out app.apk in.apk","handlingStrategy":"validation","validationCode":"static String normalizeBoolean(String raw) {\n  if (raw == null) return \"false\";\n  String v = raw.trim().toLowerCase(java.util.Locale.ROOT);\n  if (v.equals(\"1\") || v.equals(\"yes\") || v.equals(\"y\")) return \"true\";\n  if (v.equals(\"0\") || v.equals(\"no\") || v.equals(\"n\")) return \"false\";\n  if (v.equals(\"true\") || v.equals(\"false\")) return v;\n  throw new IllegalArgumentException(\"Value must be true or false (got: \" + raw + \")\");\n}\n// usage: args.add(\"--v2-signing-enabled\"); args.add(normalizeBoolean(env(\"V2_SIGNING\")));","typeGuard":null,"tryCatchPattern":"try {\n  apksignerSign(args);\n} catch (OptionsException e) {\n  if (e.getMessage().contains(\"Only true or false supported\")) {\n    System.err.println(\"Boolean flags accept exactly 'true' or 'false' (lowercase): \" + e.getMessage());\n  }\n  throw e;\n}","preventionTips":["Use exactly the lowercase literals true/false — not True, 1, 0, yes, or no.","Normalize CI/env boolean conventions (1/0, yes/no) before passing them to apksigner.","Guard against empty expansions: \": \\\"${FLAG:?not set}\\\"\".","Prefer omitting boolean flags to get library defaults rather than inventing values.","Sanitize with trim().toLowerCase() on any user-supplied boolean input."],"tags":["cli","boolean","options-parsing","apksigner"],"backgroundTag":"invalid-flag-value","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"}