{"record":{"id":"0d34d1bb71c5c21f","repo":"XTLS/Xray-core","slug":"reading-local-unknown-network-type","errorCode":null,"errorMessage":"reading local: unknown network type: ","messagePattern":"reading local: unknown network type: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/mux/frame.go","lineNumber":209,"sourceCode":"\t\tif b.Len() == 0 {\n\t\t\treturn nil\n\t\t}\n\t\tnetwork = TargetNetwork(b.Byte(0))\n\t\tif network == 0 {\n\t\t\treturn nil\n\t\t}\n\t\tb.Advance(1)\n\t\taddr, port, err = addrParser.ReadAddressPort(nil, b)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"reading local: failed to parse address and port\").Base(err)\n\t\t}\n\t\tswitch network {\n\t\tcase TargetNetworkTCP:\n\t\t\tf.Inbound.Local = net.TCPDestination(addr, port)\n\t\tcase TargetNetworkUDP:\n\t\t\tf.Inbound.Local = net.UDPDestination(addr, port)\n\t\tdefault:\n\t\t\treturn errors.New(\"reading local: unknown network type: \", network)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// Application data is essential, to test whether the pipe is closed.\n\tif f.SessionStatus == SessionStatusNew && f.Option.Has(OptionData) &&\n\t\tf.Target.Network == net.Network_UDP && b.Len() >= 8 {\n\t\tcopy(f.GlobalID[:], b.Bytes())\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":191,"sourceCodeEnd":223,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/common/mux/frame.go#L191-L223","documentation":"The local-address block's network byte was non-zero but neither TargetNetworkTCP nor TargetNetworkUDP, so FrameMetadata.Unmarshal rejects it. This is the local-destination analogue of error 163 and aborts the whole frame read.","triggerScenarios":"readSourceAndLocal=true and the byte after a valid source address holds an undefined network value; caused by corrupt frames or clients with non-conforming local-address encoding.","commonSituations":"Version drift in reverse mux, hand-crafted frames, or bit-level stream corruption.","solutions":["Log the byte value to classify corruption vs protocol mismatch.","Align endpoint versions and retest.","In custom implementations, emit only 0, TCP, or UDP in local-address network slots.","Check TLS/transport integrity (disable obfuscation temporarily)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := meta.Unmarshal(reader, true); err != nil {\n    if strings.Contains(err.Error(), \"reading local\") {\n        log.Warn(\"peer uses incompatible optional address encoding\")\n    }\n    return err\n}","preventionTips":["Restrict local-address network bytes to defined values or 0.","Keep client and server versions aligned for reverse mux.","Fuzz the unmarshaller on your server build."],"tags":["mux","reverse-proxy","validation","xray"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}