{"record":{"id":"da29541a1d5cb4a2","repo":"XTLS/Xray-core","slug":"bad-profile-uuid-length-d","errorCode":null,"errorMessage":"bad profile UUID length: %d","messagePattern":"bad profile UUID length: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"transport/internet/finalmask/xmc/profile.go","lineNumber":23,"sourceCode":"type loginProfile struct {\n\tUsername          string\n\tUUID              UUID\n\tTexturesValue     string\n\tTexturesSignature string\n}\n\nfunc profilesFromConfig(configured []*Profile) ([]loginProfile, error) {\n\tif len(configured) == 0 {\n\t\treturn nil, fmt.Errorf(\"empty profiles\")\n\t}\n\n\tprofiles := make([]loginProfile, 0, len(configured))\n\tfor _, configuredProfile := range configured {\n\t\tif configuredProfile == nil || configuredProfile.Username == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"invalid profile\")\n\t\t}\n\t\tif len(configuredProfile.Uuid) != len(UUID{}) {\n\t\t\treturn nil, fmt.Errorf(\"bad profile UUID length: %d\", len(configuredProfile.Uuid))\n\t\t}\n\t\tif configuredProfile.TexturesValue == \"\" || configuredProfile.TexturesSignature == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"incomplete profile textures\")\n\t\t}\n\n\t\tprofile := loginProfile{\n\t\t\tUsername:          configuredProfile.Username,\n\t\t\tTexturesValue:     configuredProfile.TexturesValue,\n\t\t\tTexturesSignature: configuredProfile.TexturesSignature,\n\t\t}\n\t\tcopy(profile.UUID[:], configuredProfile.Uuid)\n\t\tprofiles = append(profiles, profile)\n\t}\n\treturn profiles, nil\n}\n\nfunc findProfile(profiles []loginProfile, username string, uuid UUID) (loginProfile, bool) {\n\tfor _, profile := range profiles {","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/transport/internet/finalmask/xmc/profile.go#L5-L41","documentation":"The profile UUID must be exactly len(UUID{}) == 16 raw bytes, because it is copied byte-for-byte into the fixed-size UUID array sent in the login/handshake packets. This error reports the actual byte length when it differs, preventing copy() from producing a truncated or zero-padded identity.","triggerScenarios":"Passing a UUID field whose decoded byte length is not 16: e.g. a 36-character hyphenated string used raw, a 32-char hex string, or a base64 value that decodes to another size.","commonSituations":"Pasting the canonical Mojang UUID format 'xxxxxxxx-xxxx-...' instead of its 16-byte binary/base64 form; mixing up offline-mode vs online-mode UUID encodings; trimming or re-encoding the field during config migration.","solutions":["Supply exactly 16 bytes (e.g. base64 of the binary UUID) in the uuid field.","Convert 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' by stripping hyphens, hex-decoding, and re-encoding to base64.","Log len(cfg.Uuid) locally to see which profile is malformed — the error only prints the length, not the index."],"exampleFix":"// before (36 ASCII chars -> 36 bytes)\n\"uuid\": \"069a79f4-44e9-4726-a5be-fca90e38aaf5\"\n// after (16 raw bytes, base64)\n\"uuid\": \"Bpp59ETpRyalvvykDjiq9Q==\"","handlingStrategy":"validation","validationCode":"if len(p.Uuid) != 16 {\n    return fmt.Errorf(\"profile %q: uuid must be 16 raw bytes, got %d\", p.Username, len(p.Uuid))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store UUIDs as base64 of the 16 binary bytes, not the hyphenated string.","Convert with: b, _ := hex.DecodeString(strings.ReplaceAll(u, \"-\", \"\")) then base64.StdEncoding.EncodeToString(b).","Add a config test asserting len(Uuid)==16 for every profile."],"tags":["go","configuration","minecraft","uuid","validation"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}