{"record":{"id":"a6b78420007eca6b","repo":"XTLS/Xray-core","slug":"failed-to-read-user-hash","errorCode":null,"errorMessage":"failed to read user hash","messagePattern":"failed to read user hash","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/trojan/protocol.go","lineNumber":166,"sourceCode":"\n\treturn length, nil\n}\n\n// ConnReader is TCP Connection Reader Wrapper for trojan protocol\ntype ConnReader struct {\n\tio.Reader\n\tTarget       net.Destination\n\tFlow         string\n\theaderParsed bool\n}\n\n// ParseHeader parses the trojan protocol header\nfunc (c *ConnReader) ParseHeader() error {\n\tvar crlf [2]byte\n\tvar command [1]byte\n\tvar hash [56]byte\n\tif _, err := io.ReadFull(c.Reader, hash[:]); err != nil {\n\t\treturn errors.New(\"failed to read user hash\").Base(err)\n\t}\n\n\tif _, err := io.ReadFull(c.Reader, crlf[:]); err != nil {\n\t\treturn errors.New(\"failed to read crlf\").Base(err)\n\t}\n\n\tif _, err := io.ReadFull(c.Reader, command[:]); err != nil {\n\t\treturn errors.New(\"failed to read command\").Base(err)\n\t}\n\n\tnetwork := net.Network_TCP\n\tif command[0] == commandUDP {\n\t\tnetwork = net.Network_UDP\n\t}\n\n\taddr, port, err := addrParser.ReadAddressPort(nil, c.Reader)\n\tif err != nil {\n\t\treturn errors.New(\"failed to read address and port\").Base(err)","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/trojan/protocol.go#L148-L184","documentation":"Error \"failed to read user hash\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/trojan/protocol.go:166 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}