{"record":{"id":"5c8943f2ba5071d4","repo":"bazelbuild/bazel","slug":"unexpected-value-after-boolean-option-s","errorCode":null,"errorMessage":"Unexpected value after boolean option: %s","messagePattern":"Unexpected value after boolean option: (.+?)","errorType":"exception","errorClass":"OptionsParsingException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/google/devtools/common/options/OptionsParserImpl.java","lineNumber":799,"sourceCode":"      if (name.trim().isEmpty()) {\n        throw new OptionsParsingException(\"Invalid options syntax: \" + arg, arg);\n      }\n      unconvertedValue = equalsAt == -1 ? null : arg.substring(equalsAt + 1);\n      lookupResult = getWithFallback(OptionsData::getOptionDefinitionFromName, name, fallbackData);\n\n      // Look for a \"no\"-prefixed option name: \"no<optionName>\".\n      if (lookupResult == null && name.startsWith(\"no\")) {\n        name = name.substring(2);\n        lookupResult =\n            getWithFallback(OptionsData::getOptionDefinitionFromName, name, fallbackData);\n        booleanValue = false;\n        if (lookupResult != null) {\n          if (!lookupResult.definition.usesBooleanValueSyntax()) {\n            throw new OptionsParsingException(\n                \"Illegal use of 'no' prefix on non-boolean option: \" + arg, arg);\n          }\n          if (unconvertedValue != null) {\n            throw new OptionsParsingException(\"Unexpected value after boolean option: \" + arg, arg);\n          }\n          // \"no<optionname>\" signifies a boolean option w/ false value\n          unconvertedValue = \"0\";\n        }\n      }\n      parsedOptionName = name;\n    } else {\n      throw new OptionsParsingException(\"Invalid options syntax: \" + arg, arg);\n    }\n\n    // Do not recognize internal options, which are treated as if they did not exist.\n    if (lookupResult == null || shouldIgnoreOption(lookupResult.definition)) {\n      if (isFirstRoundOfParsing) {\n        return new ParsedOptionDescriptionOrIgnoredArgs(Optional.empty(), Optional.of(arg));\n      }\n      String suggestion;\n      // Do not offer suggestions for short-form options.\n      if (arg.startsWith(\"--\")) {","sourceCodeStart":781,"sourceCodeEnd":817,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/main/java/com/google/devtools/common/options/OptionsParserImpl.java#L781-L817","documentation":"When '--no<optionName>' resolves to a boolean-syntax option, the 'no' prefix itself already supplies the value false, so attaching '=value' is contradictory and rejected. Only the affirmative spelling '--<optionName>=value' may carry an explicit value for boolean-syntax options.","triggerScenarios":"Passing a token like `--nobuild_tests_only=true`, `--nokeep_going=0`, or any --no-prefixed boolean flag with an '=' clause.","commonSituations":"Configuring rc files (.bazelrc) or CI matrices that uniformly append '=true'/'=false' to every flag; converting a value flag to boolean and leaving '=value' in existing configs.","solutions":["Drop the value: write `--nobuild_tests_only` alone","Or use the positive spelling with a value: `--build_tests_only=false`","Sweep .bazelrc, CI yaml, and wrapper scripts for '--no...=' patterns"],"exampleFix":"# before\nbazel test --nobuild_tests_only=true //...\n# after\nbazel test --nobuild_tests_only //...   # or --build_tests_only=false","handlingStrategy":"validation","validationCode":"# Normalize flags: forbid '--no...=' combinations\nfor arg in \"$@\"; do\n  case \"$arg\" in\n    --no*=*) echo \"Boolean --no flags cannot take a value: $arg\" >&2; exit 2;;\n  esac\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use either --noflag or --flag=value, never --noflag=value","In .bazelrc and CI configs, grep for the '--no.*=' anti-pattern","Automate flag config generation from a typed schema instead of string concatenation"],"tags":["bazel","options","boolean-flag","flag-parsing","bazelrc"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}