{"record":{"id":"1cd72eb5995f590f","repo":"larksuite/cli","slug":"invalid-identity-q-must-be-user-bot","errorCode":null,"errorMessage":"invalid identity %q: must be user|bot","messagePattern":"invalid identity %q: must be user\\|bot","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"extension/platform/identity.go","lineNumber":29,"sourceCode":"// IDE help; raw-string boundaries (yaml, cobra annotation) cross\n// through ParseIdentity.\ntype Identity string\n\nconst (\n\tIdentityUser Identity = \"user\"\n\tIdentityBot  Identity = \"bot\"\n)\n\n// ParseIdentity converts a raw string into an Identity. Returns\n// (\"\", nil) for empty input (\"not specified\"), error for unrecognised\n// values. Matching is strict (case-sensitive, no trim).\nfunc ParseIdentity(s string) (Identity, error) {\n\tif s == \"\" {\n\t\treturn \"\", nil\n\t}\n\tid := Identity(s)\n\tif id != IdentityUser && id != IdentityBot {\n\t\treturn \"\", fmt.Errorf(\"invalid identity %q: must be user|bot\", s)\n\t}\n\treturn id, nil\n}\n\n// IsValid reports whether i is one of the two recognised values.\nfunc (i Identity) IsValid() bool {\n\treturn i == IdentityUser || i == IdentityBot\n}\n\n// String returns the underlying string.\nfunc (i Identity) String() string { return string(i) }\n","sourceCodeStart":11,"sourceCodeEnd":41,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/extension/platform/identity.go#L11-L41","documentation":"ParseIdentity in extension/platform only accepts \"user\" or \"bot\" (or empty, meaning unset). Any other string is rejected with this error because Identity is a closed two-value enum used to select the caller identity for API calls.","triggerScenarios":"Calling ParseIdentity with a misspelled or differently-cased value such as \"User\", \"USER\", \"application\", or a config file supplying an unknown identity string.","commonSituations":"Hand-edited config with identity: \"app\"; environment variables copied from another tool's vocabulary; case-sensitivity surprises after normalizing input to uppercase.","solutions":["Use exactly \"user\" or \"bot\" (lowercase)","Call Identity(s).IsValid() before relying on the parsed value","Lowercase and trim the input string before parsing","Leave the value empty if the identity should be inherited/unset"],"exampleFix":"// before\nid, err := platform.ParseIdentity(\"User\")\n// after\nid, err := platform.ParseIdentity(\"user\")","handlingStrategy":"validation","validationCode":"func validIdentity(s string) bool { return s == \"\" || s == \"user\" || s == \"bot\" }\nid, err := platform.ParseIdentity(strings.ToLower(strings.TrimSpace(cfg.Identity)))","typeGuard":"func isIdentity(s string) bool { switch s { case \"\", \"user\", \"bot\": return true }; return false }","tryCatchPattern":"id, err := platform.ParseIdentity(s)\nif err != nil { return fmt.Errorf(\"config identity: %w\", err) }","preventionTips":["Keep identity values lowercase in config files","Trim and lowercase user-supplied identity input","Validate config at load time, before the plugin runs","Document only user|bot as accepted values"],"tags":["plugin","identity","validation","config"],"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"}