{"record":{"id":"d0feac2eed8e9868","repo":"apache/beam","slug":"argconfig-command-arg-name-argument-must-be-specified-valid","errorCode":null,"errorMessage":"\"{ArgConfig.COMMAND_ARG_NAME}\" argument must be specified, Valid values are {COMMAND_POSSIBLE_VALUES}","messagePattern":"\"(.+?)\" argument must be specified, Valid values are (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/transform-service/launcher/src/main/java/org/apache/beam/sdk/transformservice/launcher/TransformServiceLauncher.java","lineNumber":373,"sourceCode":"  public static void main(String[] args) throws IOException, TimeoutException {\n\n    ArgConfig config = new ArgConfig();\n    CmdLineParser parser = new CmdLineParser(config);\n\n    try {\n      parser.parseArgument(args);\n    } catch (CmdLineException e) {\n      System.err.println(e.getMessage());\n      System.err.println(\"Valid options are:\");\n      // print the list of available options\n      parser.printUsage(System.err);\n      System.err.println();\n\n      return;\n    }\n\n    if (config.command.isEmpty()) {\n      throw new IllegalArgumentException(\n          \"\\\"\"\n              + ArgConfig.COMMAND_ARG_NAME\n              + \"\\\" argument must be specified, Valid values are \"\n              + COMMAND_POSSIBLE_VALUES);\n    }\n    if (config.beamVersion.isEmpty()) {\n      throw new IllegalArgumentException(\n          \"\\\"\" + ArgConfig.BEAM_VERSION_ARG_NAME + \"\\\" argument must be specified.\");\n    }\n\n    System.out.println(\"===================================================\");\n    System.out.println(\n        \"Starting the Beam Transform Service at \"\n            + (config.port < 0\n                ? \"the default port.\"\n                : (\"port \" + Integer.toString(config.port) + \".\")));\n    System.out.println(\"===================================================\");\n","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/transform-service/launcher/src/main/java/org/apache/beam/sdk/transformservice/launcher/TransformServiceLauncher.java#L355-L391","documentation":"The launcher's main() validates its parsed ArgConfig before executing: a command (up/down/ps-style value from COMMAND_POSSIBLE_VALUES) must be supplied. If config.command is empty, it throws this IllegalArgumentException naming the required argument and the valid values.","triggerScenarios":"Running the TransformServiceLauncher main class without the --command (ArgConfig.COMMAND_ARG_NAME) argument, or passing an empty value for it.","commonSituations":"Invoking java -jar ...launcher.jar with only --beam_version set; scripting the launcher and forgetting the command flag; typo of the flag name so it is not parsed as the command argument.","solutions":["Pass the command argument, e.g. --command=up (valid values listed in COMMAND_POSSIBLE_VALUES: up, down, ps, upgrade-style commands).","Check the launcher's help/usage output (it prints usage when args are invalid) for exact flag names.","Fix typos in the flag name so the value is actually parsed into config.command."],"exampleFix":"// before\njava -jar transform-service-launcher.jar --beam_version=2.59.0\n\n// after\njava -jar transform-service-launcher.jar --command=up --beam_version=2.59.0","handlingStrategy":"validation","validationCode":"Map<String,String> args = parseArgs(rawArgs);\nif (!args.containsKey(\"command\") || args.get(\"command\").isEmpty())\n  throw new IllegalArgumentException(\"--command must be specified\");","typeGuard":null,"tryCatchPattern":"try {\n  TransformServiceLauncher.main(rawArgs);\n} catch (IllegalArgumentException e) {\n  System.err.println(e.getMessage());\n  TransformServiceLauncher.main(new String[]{}); // prints usage\n}","preventionTips":["Always pass --command explicitly in scripts.","Quote shell variables so empty values are visible.","Check the launcher usage output for valid command names."],"tags":["java","cli","missing-argument","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}