{"record":{"id":"046a410d061dbfd8","repo":"XTLS/Xray-core","slug":"unknown-address-type-addrtype","errorCode":null,"errorMessage":"unknown address type: {addrType}","messagePattern":"unknown address type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/protocol/address.go","lineNumber":185,"sourceCode":"\ntype addressParser struct {\n\taddrTypeMap [16]net.AddressFamily\n\taddrByteMap [16]byte\n\ttypeParser  AddressTypeParser\n}\n\nfunc (p *addressParser) readAddress(b *buf.Buffer, reader io.Reader) (net.Address, error) {\n\tif _, err := b.ReadFullFrom(reader, 1); err != nil {\n\t\treturn nil, err\n\t}\n\n\taddrType := b.Byte(b.Len() - 1)\n\tif p.typeParser != nil {\n\t\taddrType = p.typeParser(addrType)\n\t}\n\n\tif addrType >= 16 {\n\t\treturn nil, errors.New(\"unknown address type: \", addrType)\n\t}\n\n\taddrFamily := p.addrTypeMap[addrType]\n\tif addrFamily == net.AddressFamily(afInvalid) {\n\t\treturn nil, errors.New(\"unknown address type: \", addrType)\n\t}\n\n\tswitch addrFamily {\n\tcase net.AddressFamilyIPv4:\n\t\tif _, err := b.ReadFullFrom(reader, 4); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn net.IPAddress(b.BytesFrom(-4)), nil\n\tcase net.AddressFamilyIPv6:\n\t\tif _, err := b.ReadFullFrom(reader, 16); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn net.IPAddress(b.BytesFrom(-16)), nil","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/common/protocol/address.go#L167-L203","documentation":"Returned while decoding a proxied address header when the first address-type byte is >= 16. The protocol allocates only 0-15 for known address types (IPv4/IPv6/domain plus optional padding types), so anything at or above 16 is by definition unknown and the message is considered malformed.","triggerScenarios":"readAddress reading a stream that is not actually a proxy protocol message: garbage bytes after a protocol mismatch, an encrypted stream decrypted with the wrong key/AEAD mismatch, or a framing desync that makes a length byte be interpreted as the type byte.","commonSituations":"Client and server configured with different protocols on the same port, wrong decryption (altered UUID/secret or password), or a health-checker/monitor sending plain HTTP to a proxy inbound.","solutions":["Verify client and server use the identical protocol, version, and credentials","Confirm nothing else (load balancer, CDN, monitoring probe) is injecting bytes into the stream","Capture the first bytes of the connection to confirm the framing matches the expected proxy protocol header"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"addr, err := parser.ReadAddress(buf, reader)\nif err != nil {\n    conn.Close() // framing is unrecoverable; drop the connection\n    log.Debug(\"malformed address header: \", err)\n}","preventionTips":["Drop the connection on malformed headers - the stream cannot resync","Keep protocol versions/credentials identical on both ends","Keep plain-HTTP probes off proxy ports"],"tags":["protocol","parsing","proxy","corruption"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}