{"record":{"id":"8157c387e37136ed","repo":"larksuite/cli","slug":"invalid-boolean","errorCode":null,"errorMessage":"invalid boolean","messagePattern":"invalid boolean","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_data.go","lineNumber":458,"sourceCode":"\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\nfunc hasStringConstraints(s schemaTag) bool { return s.minLength != nil || s.maxLength != nil }\nfunc hasNumberConstraints(s schemaTag) bool { return s.minimum != nil || s.maximum != nil }\nfunc hasItemConstraints(s schemaTag) bool   { return s.minItems != nil || s.maxItems != nil }\nfunc implementsCustomEncoding(t reflect.Type) bool {\n\treturn t.Implements(jsonMarshalerType) || reflect.PointerTo(t).Implements(jsonMarshalerType) || t.Implements(textMarshalerType) || reflect.PointerTo(t).Implements(textMarshalerType)\n}\nfunc parseBool(raw string) (bool, error) {\n\tswitch raw {\n\tcase \"true\":\n\t\treturn true, nil\n\tcase \"false\":\n\t\treturn false, nil\n\tdefault:\n\t\treturn false, fmt.Errorf(\"invalid boolean\")\n\t}\n}\n","sourceCodeStart":440,"sourceCodeEnd":461,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_data.go#L440-L461","documentation":"parseBool accepts only the literal strings \"true\" and \"false\". It is used by shapeForType when lowering the enum of a bool-typed field from the schema tag; any other enum member string for a boolean field fails here and is surfaced (wrapped as \"enum value %q is not boolean\"). Go's strconv.ParseBool flexibility (1/0/TRUE/True) is intentionally not accepted.","triggerScenarios":"Declaring a bool field in the data/args struct with a schema enum tag containing a value other than exactly \"true\" or \"false\", e.g. enum:\"1,0\" or enum:\"TRUE,False\".","commonSituations":"Copy-pasting numeric-bool conventions (0/1) from OpenAPI or protobuf enums; capitalizing booleans by habit; forgetting that this parser is stricter than strconv.ParseBool.","solutions":["Change the enum tag to lowercase literals only, e.g. enum:\"true,false\".","Remove the enum from the bool field if both values are allowed (an unconstrained bool needs no enum).","If 0/1 semantics are needed, change the Go field type to int and declare an integer enum instead."],"exampleFix":"// before\ntype Data struct {\n  Enabled bool `schema:\"enum:1,0\"`\n}\n// after\ntype Data struct {\n  Enabled bool `schema:\"enum:true,false\"`\n}","handlingStrategy":"validation","validationCode":"func validBoolEnum(tag string) error {\n  for _, v := range strings.Split(tag, \",\") {\n    if v != \"true\" && v != \"false\" {\n      return fmt.Errorf(\"enum value %q is not exactly true/false\", v)\n    }\n  }\n  return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use lowercase \"true\"/\"false\" in enum tags on bool fields — not 0/1, TRUE, or True.","Drop the enum tag entirely for unconstrained booleans.","Use an int field with an integer enum when tri-state or numeric bools are needed."],"tags":["boolean","enum","schema","parsing"],"backgroundTag":"invalid-enum-value","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}