{"record":{"id":"4555e984f96f92c8","repo":"XTLS/Xray-core","slug":"invalid-minecraft-profile-username-q","errorCode":null,"errorMessage":"invalid minecraft profile username: %q","messagePattern":"invalid minecraft profile username: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_finalmask.go","lineNumber":742,"sourceCode":"\tHostname string       `json:\"hostname\"`\n\tProfiles []XMCProfile `json:\"profiles\"`\n\tPassword string       `json:\"password\"`\n}\n\ntype XMCProfile struct {\n\t// Resolve the UUID by username, then request the session profile with\n\t// unsigned=false. Client and server must use the same signed profile.\n\tUsername          string `json:\"username\"`\n\tUUID              string `json:\"uuid\"`\n\tTexturesValue     string `json:\"texturesValue\"`\n\tTexturesSignature string `json:\"texturesSignature\"`\n}\n\nvar xmcUsernamePattern = regexp.MustCompile(`^[A-Za-z0-9_]{3,16}$`)\n\nfunc (c *XMCProfile) Build() (*xmc.Profile, error) {\n\tif !xmcUsernamePattern.MatchString(c.Username) {\n\t\treturn nil, fmt.Errorf(\"invalid minecraft profile username: %q\", c.Username)\n\t}\n\n\tprofileUUID, err := googleuuid.Parse(c.UUID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid minecraft profile UUID: %w\", err)\n\t}\n\tif c.TexturesValue == \"\" || c.TexturesSignature == \"\" {\n\t\treturn nil, fmt.Errorf(\"incomplete minecraft profile textures\")\n\t}\n\n\treturn &xmc.Profile{\n\t\tUsername:          c.Username,\n\t\tUuid:              append([]byte(nil), profileUUID[:]...),\n\t\tTexturesValue:     c.TexturesValue,\n\t\tTexturesSignature: c.TexturesSignature,\n\t}, nil\n}\n","sourceCodeStart":724,"sourceCodeEnd":760,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_finalmask.go#L724-L760","documentation":"XMCProfile.Build validates the Minecraft profile username against ^[A-Za-z0-9_]{3,16}$ before building the xmc.Profile. This error fires when the configured username fails that regex; %q shows the exact offending value.","triggerScenarios":"Setting an xmc (Minecraft protocol masking) transport profile username that is shorter than 3 chars, longer than 16, or contains characters outside letters/digits/underscore (spaces, dashes, unicode).","commonSituations":"Using a new-style username with spaces; truncating a username during copy-paste; assuming offline-mode arbitrary names are allowed; entering the UUID into the username field by mistake.","solutions":["Set username to a real Mojang/Minecraft account name (3-16 chars, A-Z a-z 0-9 _ only)","Remove spaces, dashes, dots and unicode from the value","Confirm the field mapping: username goes to \"username\", the dashed UUID goes to \"uuid\""],"exampleFix":"// before\n\"username\": \"Steve ##\"\n\n// after\n\"username\": \"Steve\"","handlingStrategy":"validation","validationCode":"var xmcUsernameRe = regexp.MustCompile(`^[A-Za-z0-9_]{3,16}$`)\n\nfunc validXmcUsername(name string) bool {\n    return xmcUsernameRe.MatchString(name)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use real Mojang account names (3-16 chars, [A-Za-z0-9_])","Validate profile objects in your config pipeline before deploy"],"tags":["xmc","minecraft","validation","config"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}