{"record":{"id":"20c888ae5188b513","repo":"larksuite/cli","slug":"s-must-be-one-of-s","errorCode":null,"errorMessage":"%s must be one of: %s","messagePattern":"(.+?) must be one of: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_binder.go","lineNumber":426,"sourceCode":"\t\t}\n\t\tif !reflect.DeepEqual(value, expected) {\n\t\t\treturn fmt.Errorf(\"%s must equal %v\", path, constraint.Value)\n\t\t}\n\t\treturn nil\n\tcase typedStringShape:\n\t\ttext, ok := value.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be a string\", path)\n\t\t}\n\t\tlength := len([]rune(text))\n\t\tif constraint.MinLength != nil && length < *constraint.MinLength {\n\t\t\treturn fmt.Errorf(\"%s must contain at least %d characters\", path, *constraint.MinLength)\n\t\t}\n\t\tif constraint.MaxLength != nil && length > *constraint.MaxLength {\n\t\t\treturn fmt.Errorf(\"%s must contain at most %d characters\", path, *constraint.MaxLength)\n\t\t}\n\t\tif len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, text) {\n\t\t\treturn fmt.Errorf(\"%s must be one of: %s\", path, strings.Join(constraint.Enum, \", \"))\n\t\t}\n\t\treturn nil\n\tcase typedBooleanShape:\n\t\tboolean, ok := value.(bool)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be a boolean\", path)\n\t\t}\n\t\tif len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, boolean) {\n\t\t\treturn fmt.Errorf(\"%s has an unsupported boolean value\", path)\n\t\t}\n\t\treturn nil\n\tcase typedIntegerShape:\n\t\tnumber, ok := validationInteger(value)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be an integer\", path)\n\t\t}\n\t\tif constraint.Minimum != nil && number < *constraint.Minimum {\n\t\t\treturn fmt.Errorf(\"%s must be at least %d\", path, *constraint.Minimum)","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_binder.go#L408-L444","documentation":"The typed binder rejected a string value that is not a member of the field's enum constraint. When a schema declares an enumerated set of allowed strings, any other string is refused locally before the API call. The error lists every accepted value so the caller can pick a valid one.","triggerScenarios":"Passing a string flag/argument whose schema has constraint.Enum set with a value not in that set (case differences and whitespace count as mismatches); setting a nested object field to a non-enum string validated by valueCompatibleWithShape.","commonSituations":"Typing 'Active' instead of 'active'; using a human label ('In Progress') instead of the API token ('in_progress'); stale documentation from an older enum set; translating values from another API.","solutions":["Use one of the values listed in the error message exactly (match case and spelling)","Inspect the field's allowed values with the command's `schema` output","Normalize casing/whitespace of user-supplied input before binding","If a needed value is missing from the enum, update the CLI/catalog metadata to the latest schema"],"exampleFix":"// before\nstatus := \"In Progress\"\ncall(field(status))\n// after\nstatus := \"in_progress\" // must be one of the schema's enum values\ncall(field(status))","handlingStrategy":"validation","validationCode":"func ensureEnum(s string, allowed []string) error {\n    if !slices.Contains(allowed, s) {\n        return fmt.Errorf(\"%q not in %v\", s, allowed)\n    }\n    return nil\n}","typeGuard":"func isAllowedString(v any, allowed ...string) bool {\n    s, ok := v.(string)\n    return ok && slices.Contains(allowed, s)\n}","tryCatchPattern":"if err := bind(field, status); err != nil {\n    if strings.Contains(err.Error(), \"must be one of:\") {\n        return fmt.Errorf(\"invalid %s: %w (see `lark ... schema` for allowed values)\", field, err)\n    }\n    return err\n}","preventionTips":["Define allowed values as Go constants or an enum type instead of raw strings","Run the command with `schema` first when exploring a new field","Normalize case/whitespace of user input against the enum list","Copy values from `schema` output rather than from memory or docs"],"tags":["validation","cli","enum","schema"],"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"}