Transfer failed: "Protocol not supported by address family"
(I'm sorry that my english is not good)
Minecraft Version: 1.21.7 / 1.21.4 / 1.21.1
NeoForge Version: 21.7.20-beta / 21.4.147 / 21.1.146
Logs:
1.21.4 NeoForge Client: https://mclo.gs/DpLRDCZ (I don't know why it display server, but it really client log) 1.21.7 NeoForge Client: https://mclo.gs/yd5qmtE 1.21.1 NeoForge Client: https://mclo.gs/Zjzm5qT
Although server software is not Neoforge, it maybe useful. I test transfer at 18:20
Velocity: https://mclo.gs/eUKnqOB Paper 1.21.4 (backend): https://mclo.gs/c0BvQKZ Paper 1.21.4 (standalone): https://mclo.gs/7rsOyZu (Server not crashed, I stop them)
Description of issue:
My first test server is velocity-3.4.0-521 with a paper-1.21.4-229 backend and use legacy ip-forward, second test server is a standalone paper-1.21.4-229 server. I want to try to transfer from first server's backend to second server.
I use 1.21.7 neoforge to test this, and get an error "Protocol not supported by address family"
This problem also exist in 1.21.4 neoforge 21.4.147, 1.21.1 neoforge 21.1.146.
(I'm tried to let it show english error infomation but failed)
1.21.7 Vanilla client, 1.21.4 Fabric 0.16.14, 1.21.1 Optifine are haven't this problem. Just like this picture.
(There is some misspelling of transfer in this image, and NeoForge 1.21.7, 1.21.4, 1.21.1 can't transfer normally)
Steps to Reproduce:
- Download and run Velocity and two Paper, one Paper is the backend server under the Velocity with legacy ip-forward, another Paper is standalone.
- Start a 1.21.4/1.21.7 NeoForge Game and connent the Velocity and arrive at the backend server.
- Use
/transfercommand to transfer the standalone paper server.
Hi, I've been exploring the same issue for months, but independently. After testing Forge 1.16.5, 1.18.2, 1.20.1 and NeoForge 1.21.1 and 1.21.8, I've been able to reach to a preliminary conclusion of the whole issue.
Minimal reproducibility requirements
- Operating System: Linux
- Minecraft Version and Loader: NeoForge 1.20.1 ~ 1.21.8; Forge 1.18.2 ~ ?(>= 1.20.1)
- Not related to any certain mod, aka. no mod needs to be installed
Minimal steps to reproduce
- Open Minecraft with the requirements above;
- Open "Multiplayer" Screen, and create two servers, one with only IPv4 address, another with only IPv6 address.
For example, you can launch a local vanilla server, and add
127.0.0.1and[::1]respectively. - Restart the game and try to connect the IPv6 one. The "Protocol not supported by address family" issue may randomly occur. If not, restart the game again.
Example logs (debug.log)
- "Protocol not supported by address family" issue occurred: https://mclo.gs/3KW6Tsy
- "Protocol not supported by address family" issue didn't occur: https://mclo.gs/3LMAV4z
Preliminary analysis and possible cause/workaround
When the issue occurs, we found
'''
[31Aug2025 20:37:36.374] [Server Pinger #0/DEBUG] [io.netty.util.NetUtil/]: -Djava.net.preferIPv4Stack: true
[31Aug2025 20:37:36.374] [Server Pinger #0/DEBUG] [io.netty.util.NetUtil/]: -Djava.net.preferIPv6Addresses: false
'''
And when the issue doesn't occur, we found
'''
[31Aug2025 20:38:01.592] [Server Pinger #0/DEBUG] [io.netty.util.NetUtil/]: -Djava.net.preferIPv4Stack: false
[31Aug2025 20:38:01.592] [Server Pinger #0/DEBUG] [io.netty.util.NetUtil/]: -Djava.net.preferIPv6Addresses: true
'''
.
It seems that NeoForge and Forge are trying to determine the -Djava.net.preferIPv4Stack and -Djava.net.preferIPv6Addresses parameters used by the netty thread used by the Server Connector(and maybe Pinger) by first successful ping, and Netty only tries to create IPv4-only network stack on Linux. Explicitly passing the two parameters to Minecraft is useless to solve the issue, and the two parameters in debug.log may be different from what is passed to Minecraft. A workaround is only using IPv4 or IPv6(NOT BOTH) to connect to the server, or ensuring every server in the Multiplayer Screen is dualstack.
Relevant code is in src/main/java/net/neoforged/neoforge/network/DualStackUtils.java. I'm not sure why they set java.net.preferIPv4Stack and java.net.preferIPv6Addresses according to the server address in this file, and vanilla and Fabric don't do that. Is it used to fix another error?
The problem might also happen if you enter singleplayer world before opening the multiplayer screen!