{"record":{"id":"90c5a34bf765d5f9","repo":"shwenzhang/AndResGuard","slug":"unsupported-command-cmd-see-help-for-supported-commands","errorCode":null,"errorMessage":"Unsupported command: <cmd>. See --help for supported commands","messagePattern":"Unsupported command: <cmd>\\. See --help for supported commands","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java","lineNumber":99,"sourceCode":"      return;\n    }\n\n    String cmd = params[0];\n    try {\n      if (\"sign\".equals(cmd)) {\n        sign(Arrays.copyOfRange(params, 1, params.length));\n        return;\n      } else if (\"verify\".equals(cmd)) {\n        verify(Arrays.copyOfRange(params, 1, params.length));\n        return;\n      } else if (\"help\".equals(cmd)) {\n        printUsage(HELP_PAGE_GENERAL);\n        return;\n      } else if (\"version\".equals(cmd)) {\n        System.out.println(VERSION);\n        return;\n      } else {\n        throw new ParameterException(\"Unsupported command: \" + cmd + \". See --help for supported commands\");\n      }\n    } catch (ParameterException | OptionsParser.OptionsException e) {\n      System.err.println(e.getMessage());\n      System.exit(1);\n      return;\n    }\n  }\n\n  private static void sign(String[] params) throws Exception {\n    if (params.length == 0) {\n      printUsage(HELP_PAGE_SIGN);\n      return;\n    }\n\n    File outputApk = null;\n    File inputApk = null;\n    boolean verbose = false;\n    boolean v1SigningEnabled = true;","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/apksigner/ApkSignerTool.java#L81-L117","documentation":"The apksigner CLI only supports a fixed set of top-level commands: sign, verify, help/version and --help. When the first positional argument does not match any of them, main throws this ParameterException before any signing work starts.","triggerScenarios":"Running the tool with an unrecognized first argument, e.g. `apksigner signtest ...` (misspelling 'sign'), or passing a file path or flag as the first argument instead of a command.","commonSituations":"Typo in the command name; copying an old or different tool's CLI syntax; scripts invoking the tool with a file argument first instead of 'sign' or 'verify'.","solutions":["Run `apksigner --help` to list supported commands","Use exactly `sign` or `verify` as the first argument","Fix the typo or restructure the invocation so the command comes first"],"exampleFix":"// before\napksigner signt --ks release.jks --out app-signed.apk app.apk\n// after\napksigner sign --ks release.jks --out app-signed.apk app.apk","handlingStrategy":"validation","validationCode":"String[] COMMANDS = {\"sign\",\"verify\",\"help\",\"version\"};\nif (args.length == 0 || !Arrays.asList(COMMANDS).contains(args[0])) {\n    throw new IllegalArgumentException(\"First argument must be one of \" + Arrays.toString(COMMANDS));\n}","typeGuard":"boolean isSupportedCommand(String a0) {\n    return a0 != null && (a0.equals(\"sign\") || a0.equals(\"verify\") || a0.equals(\"help\") || a0.equals(\"version\") || a0.equals(\"--help\") || a0.equals(\"-h\"));\n}","tryCatchPattern":"// main already catches ParameterException and prints usage; when scripting:\napksigner --help | grep -q \"^<cmd>\" || { echo \"unsupported command\"; exit 1; }","preventionTips":["Always start the command line with sign or verify","Check --help before scripting new invocations","Validate args[0] in wrapper scripts"],"tags":["cli","argument-parsing"],"backgroundTag":"command-not-found","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"}