{"record":{"id":"b62df6d142364df8","repo":"larksuite/cli","slug":"profile-name-q-is-too-long-max-64-characters","errorCode":null,"errorMessage":"profile name %q is too long (max 64 characters)","messagePattern":"profile name %q is too long \\(max 64 characters\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/core/config.go","lineNumber":166,"sourceCode":"\n// ProfileNames returns all profile names (Name if set, otherwise AppId).\nfunc (m *MultiAppConfig) ProfileNames() []string {\n\tnames := make([]string, len(m.Apps))\n\tfor i := range m.Apps {\n\t\tnames[i] = m.Apps[i].ProfileName()\n\t}\n\treturn names\n}\n\n// ValidateProfileName checks that a profile name is valid.\n// Rejects empty names, whitespace, control characters, and shell-problematic characters,\n// but allows Unicode letters (e.g. Chinese, Japanese) for localized profile names.\nfunc ValidateProfileName(name string) error {\n\tif name == \"\" {\n\t\treturn fmt.Errorf(\"profile name cannot be empty\")\n\t}\n\tif utf8.RuneCountInString(name) > 64 {\n\t\treturn fmt.Errorf(\"profile name %q is too long (max 64 characters)\", name)\n\t}\n\tfor _, r := range name {\n\t\tif r <= 0x1F || r == 0x7F { // control characters\n\t\t\treturn fmt.Errorf(\"invalid profile name %q: contains control characters\", name)\n\t\t}\n\t\tswitch r {\n\t\tcase ' ', '\\t', '/', '\\\\', '\"', '\\'', '`', '$', '#', '!', '&', '|', ';', '(', ')', '{', '}', '[', ']', '<', '>', '?', '*', '~':\n\t\t\treturn fmt.Errorf(\"invalid profile name %q: contains invalid character %q\", name, r)\n\t\t}\n\t}\n\treturn nil\n}\n\n// CliConfig is the resolved single-app config used by downstream code.\ntype CliConfig struct {\n\tProfileName         string\n\tAppID               string\n\tAppSecret           string","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/core/config.go#L148-L184","documentation":"Guard in ValidateProfileName rejecting profile names longer than 64 characters. Fires from config init, profile add, and profile rename when the supplied name exceeds the storage/display length cap.","triggerScenarios":"ValidateProfileName receives a name whose utf8.RuneCountInString exceeds 64 — commonly pasted long descriptions or generated names used as profiles.","commonSituations":"Pasting a sentence as a profile name; auto-generating names from tokens/emails that concatenate to >64 chars; CJK names counted by bytes elsewhere then assumed valid.","solutions":["Shorten the profile name to 64 runes or fewer","Use a short name plus the profile's own description fields if supported","Truncate programmatically by runes, not bytes"],"exampleFix":"// before\nname := longString\nerr := core.ValidateProfileName(name)\n// after\nrunes := []rune(longString)\nif len(runes) > 64 { runes = runes[:64] }\nerr := core.ValidateProfileName(string(runes))","handlingStrategy":"validation","validationCode":"runes := []rune(name)\nif len(runes) > 64 {\n    return fmt.Errorf(\"profile name must be at most 64 runes, got %d\", len(runes))\n}","typeGuard":null,"tryCatchPattern":"if err := core.ValidateProfileName(name); err != nil {\n    if strings.Contains(err.Error(), \"too long\") {\n        name = string([]rune(name)[:64])\n        if err := core.ValidateProfileName(name); err != nil { return err }\n    }\n}","preventionTips":["Count length in runes, not bytes, for CJK names","Keep profile names short and mnemonic","Validate before writing any config"],"tags":["go","validation","profile-name-length"],"backgroundTag":"profile-name-too-long","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"}