{"record":{"id":"8399179739e7b8a7","repo":"bazelbuild/bazel","slug":"expected-value-after-s","errorCode":null,"errorMessage":"Expected value after %s","messagePattern":"Expected value after (.+?)","errorType":"exception","errorClass":"OptionsParsingException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/google/devtools/common/options/OptionsParserImpl.java","lineNumber":836,"sourceCode":"        suggestion = SpellChecker.didYouMean(arg, getAllValidArgs());\n      } else {\n        suggestion = \"\";\n      }\n      throw new OptionsParsingException(\"Unrecognized option: \" + arg + suggestion, arg);\n    }\n\n    if (unconvertedValue == null) {\n      // Special-case boolean to supply value based on presence of \"no\" prefix.\n      if (lookupResult.definition.usesBooleanValueSyntax()) {\n        unconvertedValue = booleanValue ? \"1\" : \"0\";\n      } else if (lookupResult.definition.getType().equals(Void.class)) {\n        // This is expected, Void type options have no args.\n      } else if (nextArgs.hasNext()) {\n        // \"--flag value\" form\n        unconvertedValue = nextArgs.next();\n        commandLineForm.append(\" \").append(unconvertedValue);\n      } else {\n        throw new OptionsParsingException(\"Expected value after \" + arg);\n      }\n    }\n\n    if (lookupResult.fromFallback) {\n      // The option was not found on the current command, but is a valid option for some other\n      // command. Ignore it.\n      return new ParsedOptionDescriptionOrIgnoredArgs(\n          Optional.empty(), Optional.of(commandLineForm.toString()));\n    }\n\n    return new ParsedOptionDescriptionOrIgnoredArgs(\n        Optional.of(\n            ParsedOptionDescription.newParsedOptionDescription(\n                lookupResult.definition,\n                commandLineForm.toString(),\n                unconvertedValue,\n                new OptionInstanceOrigin(\n                    priority,","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/main/java/com/google/devtools/common/options/OptionsParserImpl.java#L818-L854","documentation":"A non-boolean, non-Void option was given in the '--flag value' two-token form but no further argument exists to consume as its value. Boolean-syntax options self-default and Void options take no value, so only value-taking options reach the nextArgs.hasNext() check; at end-of-argv the value is missing and this error names the flag token.","triggerScenarios":"Ending the command line with a value-taking flag: `bazel build //... --platforms`, or a params file whose last line is a bare flag; truncating an argv array mid pair.","commonSituations":"Scripts appending flags conditionally where the value append is skipped; params files edited by hand leaving the last flag valueless; shell line continuation breaking after the flag token.","solutions":["Supply the value, ideally in '=' form to keep the pair atomic: `--platforms=//tools:platform`","Fix the generator: when appending a value flag, append name and value together or use the '=' form in one token","Check params files / .bazelrc for a final line that is a bare value-taking flag"],"exampleFix":"# before\nbazel build --platforms //...\n# after\nbazel build --platforms=//tools:default_platform //...","handlingStrategy":"validation","validationCode":"# Ensure value flags always carry '=' so a missing value is impossible\nemit() { case \"$1\" in --*=*) ;; --*) echo \"flag '$1' needs =value\" >&2; exit 2;; esac; printf '%s ' \"$1\"; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer '--flag=value' over the two-token '--flag value' form","Append flag+value pairs atomically in scripts","Validate that params files don't end with a bare value-taking flag"],"tags":["bazel","options","flag-parsing","missing-value","params-file"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}