{"record":{"id":"44c65c9ad196a58a","repo":"stanfordnlp/CoreNLP","slug":"bad-arguments-after-flag","errorCode":null,"errorMessage":"Bad arguments after ${flag}","messagePattern":"Bad arguments after (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/parser/common/ArgUtils.java","lineNumber":84,"sourceCode":"          filter = new NumberRangesFileFilter(args[argIndex], true);\n        }\n        argIndex++;\n      } else if (numSubArgs == 3) {\n        try {\n          int low = Integer.parseInt(args[argIndex]);\n          int high = Integer.parseInt(args[argIndex + 1]);\n          filter = new NumberRangeFileFilter(low, high, true);\n          argIndex += 2;\n        } catch (NumberFormatException e) {\n          // maybe it's a ranges expression?\n          filter = new NumberRangesFileFilter(args[argIndex++], true);\n        }\n      }\n      if (hasWeight) {\n        argIndex++;\n      }\n    } else {\n      throw new IllegalArgumentException(\"Bad arguments after \" + flag);\n    }\n    return Triple.makeTriple(path, filter, weight);\n  }\n}\n","sourceCodeStart":66,"sourceCodeEnd":89,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/parser/common/ArgUtils.java#L66-L89","documentation":"ArgUtils.getWeightedTreebankDescription() throws this IllegalArgumentException when the argument array following the description flag is malformed — the expected path/filter/optional-weight pattern could not be parsed. It signals that the command-line token layout for a treebank description is invalid.","triggerScenarios":"Passing a malformed treebank description on the command line, e.g. a missing path or filter after the flag, or leftover unrecognized tokens where the weight should be (when hasWeight is set the parser consumes one extra arg and finds garbage).","commonSituations":"Typos in the treebank description syntax; quoting mistakes in the shell that split or drop tokens; copying an example with a different flag arity.","solutions":["Check the description syntax: path, filter, and optionally a weight argument after the flag","Quote arguments containing spaces so the shell passes them as single tokens","Inspect the parsed token sequence around the flag to find the unexpected token"],"exampleFix":"// before\n-train treebank  (missing filter/weight)\n// after\n-train /data/treebank \"\" 1.0","handlingStrategy":"validation","validationCode":"if (args.length < argIndex + 2) { throw new IllegalArgumentException(\"treebank description needs path and filter after \" + flag); }","typeGuard":null,"tryCatchPattern":"try { desc = ArgUtils.getWeightedTreebankDescription(args, argIndex, flag); } catch (IllegalArgumentException e) { System.err.println(\"Bad treebank description: \" + e.getMessage()); System.exit(1); }","preventionTips":["Quote arguments containing spaces in the shell","Verify the description syntax (path, filter, optional weight) against the documentation","Print full argv when debugging flag parsing failures"],"tags":["java","command-line","argument-parsing"],"backgroundTag":"invalid-cli-argument","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}