{"record":{"id":"69eb8103ff7fbb52","repo":"bazelbuild/bazel","slug":"not-a-valid-s-s-should-be-auto-or-a-boolean","errorCode":null,"errorMessage":"Not a valid %s: '%s' (should be auto or a boolean)","messagePattern":"Not a valid (.+?): '(.+?)' \\(should be auto or a boolean\\)","errorType":"validation","errorClass":"OptionsParsingException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/google/devtools/common/options/Converters.java","lineNumber":174,"sourceCode":"      super(TriState.class, \"tri-state (auto, yes, no) option value\");\n    }\n\n    @Override\n    public TriState convert(@Nullable String input) throws OptionsParsingException {\n      if (input == null) {\n        return TriState.AUTO;\n      }\n      input = Ascii.toLowerCase(input);\n      if (input.equals(\"auto\")) {\n        return TriState.AUTO;\n      }\n      if (ENABLED_REPS.contains(input)) {\n        return TriState.YES;\n      }\n      if (DISABLED_REPS.contains(input)) {\n        return TriState.NO;\n      }\n      throw new OptionsParsingException(\n          \"Not a valid %s: '%s' (should be auto or a boolean)\".formatted(typeName, input));\n    }\n\n    @Override\n    public String getTypeDescription() {\n      return \"a tri-state (auto, yes, no)\";\n    }\n  }\n\n  /**\n   * Standard \"converter\" for Void. Should not actually be invoked. For instance, expansion flags\n   * are usually Void-typed and do not invoke the converter.\n   */\n  public static class VoidConverter extends Converter.Contextless<Void> {\n    @Override\n    public Void convert(String input) throws OptionsParsingException {\n      if (input == null || input.equals(\"null\")) {\n        return null; // expected input, return is unused so null is fine.","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/main/java/com/google/devtools/common/options/Converters.java#L156-L192","documentation":"Thrown by the TriState converter (Converters line 174) when the input is neither \"auto\" nor one of the accepted boolean spellings (true/1/yes/t/y, false/0/no/f/n, case-insensitive). TriState options distinguish \"explicitly on\", \"explicitly off\", and \"not set / automatic\", so arbitrary strings are rejected at parse time.","triggerScenarios":"Passing --my_tristate=maybe, --my_tristate=unset, or --my_tristate=\"\" to a TriState-typed option; also passing on/off which this converter does not accept.","commonSituations":"Users assuming on/off works because other tools accept it; trying to \"reset\" a flag by giving an empty value instead of auto; script defaults that fall back to an invalid token.","solutions":["Use auto to let the flag decide automatically, or one of the boolean spellings (e.g. yes/no) for an explicit choice.","To unset a TriState flag, simply omit it from the command line or use auto.","Update stale scripts that still write on/off."],"exampleFix":"# before\nbazel build --my_tristate=on //...\n# after\nbazel build --my_tristate=yes //...","handlingStrategy":"validation","validationCode":"boolean isParsableTriState(String s) {\n  if (s == null) return false;\n  String v = s.toLowerCase(Locale.ROOT);\n  return v.equals(\"auto\")\n      || Set.of(\"true\",\"1\",\"yes\",\"t\",\"y\",\"false\",\"0\",\"no\",\"f\",\"n\").contains(v);\n}","typeGuard":"boolean isTriStateFlagValue(String s) {\n  return s != null && s.matches(\"(?i)(auto|true|false|1|0|yes|no|t|f|y|n)\");\n}","tryCatchPattern":null,"preventionTips":["Use auto rather than empty values to reset TriState flags.","Keep on/off out of generated configs for TriState flags.","Encode the allowed spellings in one shared constant used by both docs and scripts."],"tags":["bazel","options","converter","tri-state","cli"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}