{"record":{"id":"cdd3f3f501f36b6b","repo":"XTLS/Xray-core","slug":"failed-to-parse-id","errorCode":null,"errorMessage":"failed to parse ID","messagePattern":"failed to parse ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/vless/account.go","lineNumber":15,"sourceCode":"package vless\n\nimport (\n\t\"google.golang.org/protobuf/proto\"\n\n\t\"github.com/xtls/xray-core/common/errors\"\n\t\"github.com/xtls/xray-core/common/protocol\"\n\t\"github.com/xtls/xray-core/common/uuid\"\n)\n\n// AsAccount implements protocol.Account.AsAccount().\nfunc (a *Account) AsAccount() (protocol.Account, error) {\n\tid, err := uuid.ParseString(a.Id)\n\tif err != nil {\n\t\treturn nil, errors.New(\"failed to parse ID\").Base(err).AtError()\n\t}\n\treturn &MemoryAccount{\n\t\tID:         protocol.NewID(id),\n\t\tFlow:       a.Flow,       // needs parser here?\n\t\tEncryption: a.Encryption, // needs parser here?\n\t\tXorMode:    a.XorMode,\n\t\tSeconds:    a.Seconds,\n\t\tPadding:    a.Padding,\n\t\tReverse:    a.Reverse,\n\t\tTestpre:    a.Testpre,\n\t\tTestseed:   a.Testseed,\n\t}, nil\n}\n\n// MemoryAccount is an in-memory form of VLess account.\ntype MemoryAccount struct {\n\t// ID of the account.\n\tID *protocol.ID","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/vless/account.go#L1-L33","documentation":"When a VLESS inbound/outbound account is instantiated, the configured Id string must parse as a UUID (uuid.ParseString). Failure returns this error at error severity. Common base causes: typo (wrong character, e.g. 'g'-'z' are invalid in hex UUIDs), wrong length, dashes missing or misplaced, empty string, or a copied UUID with invisible whitespace/quotes.","triggerScenarios":"VLESS client/server config with an id like \"b831381d-6324-4d53-ad4f-8cda48b3081g\" (invalid hex char), truncated UUID, or \"\"; provisioning pipelines that generate non-canonical UUID strings; JSON escaping issues adding quotes into the value.","commonSituations":"Hand-edited configs; copy-paste from tutorials introducing whitespace; scripts that format UUIDv7 or ULIDs (not accepted); trailing newline in env-provided id.","solutions":["Regenerate the id with `xray uuid` and paste it exactly into both client and server","Trim whitespace/newlines and verify the string against canonical 8-4-4-4-12 hex format","Ensure both peers use the identical id"],"exampleFix":"// before\n\"id\": \"b831381d-6324-4d53-ad4f-8cda48b3081g \"\n\n// after\n\"id\": \"b831381d-6324-4d53-ad4f-8cda48b30811\"","handlingStrategy":"validation","validationCode":"func isValidXrayID(id string) bool {\n\t_, err := uuid.ParseString(id)\n\treturn err == nil\n}\n\nif !isValidXrayID(cfg.Id) {\n\tlog.Fatalf(\"invalid vless id %q (generate with `xray uuid`)\", cfg.Id)\n}","typeGuard":"func isVLESSId(v string) bool {\n\tif len(v) != 36 { return false }\n\tfor i, c := range v {\n\t\tswitch i {\n\t\tcase 8, 13, 18, 23:\n\t\t\tif c != '-' { return false }\n\t\tdefault:\n\t\t\tif !((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) { return false }\n\t\t}\n\t}\n\treturn true\n}","tryCatchPattern":"acct, err := rawAccount.AsAccount()\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to parse ID\") {\n\t\t// regenerate id via uuid.New() and rewrite config\n\t}\n\treturn err\n}","preventionTips":["Generate ids with `xray uuid` or uuid.New()","Copy ids without trailing whitespace or quotes","Keep client and server ids byte-identical"],"tags":["vless","uuid","config","account"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}