{"record":{"id":"cb6b8fc1c90d5786","repo":"XTLS/Xray-core","slug":"failed-to-read-address-and-port","errorCode":null,"errorMessage":"failed to read address and port","messagePattern":"failed to read address and port","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/trojan/protocol.go","lineNumber":184,"sourceCode":"\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)\n\t}\n\tc.Target = net.Destination{Network: network, Address: addr, Port: port}\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\tc.headerParsed = true\n\treturn nil\n}\n\n// Read implements io.Reader\nfunc (c *ConnReader) Read(p []byte) (int, error) {\n\tif !c.headerParsed {\n\t\tif err := c.ParseHeader(); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/trojan/protocol.go#L166-L202","documentation":"Error \"failed to read address and port\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/trojan/protocol.go:184 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-15T17:31:12.345Z"}