Fixing GitHub Copilot Network Errors on Linux

Posted on Fri 24 January 2025 in Developer Tools • 1 min read

If GitHub Copilot in VS Code consistently fails with net::ERR_NETWORK_CHANGED errors despite a stable internet connection, the cause is likely a problematic IPv6 configuration.

The Problem

GitHub Copilot fails intermittently with network errors. The VS Code Copilot diagnostic logs show:

  • Successful IPv4 connections to GitHub services
  • Errors during IPv6 DNS lookups (getaddrinfo ENOTFOUND)

The system's attempts to use IPv6, followed by failures or fallbacks to IPv4, trigger "network changed" errors in VS Code's Electron framework.

The Solution

Disable IPv6 at the kernel level to force consistent IPv4 usage.

Quick Test (Temporary)

Run these commands to confirm IPv6 is the issue:

sudo sysctl net.ipv6.conf.all.disable_ipv6=1
sudo sysctl net.ipv6.conf.default.disable_ipv6=1

If Copilot works after this, proceed with the permanent fix.

Permanent Fix

Create a sysctl configuration file:

sudo nano /etc/sysctl.d/99-disable-ipv6.conf

Add these lines:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Apply immediately:

sudo sysctl --system

The settings now persist across reboots.

Why Not NetworkManager?

Disabling IPv6 via NetworkManager's GUI often doesn't persist or doesn't apply system-wide. The sysctl approach works at the kernel level and is more reliable.

Re-enabling IPv6

If you need IPv6 later:

sudo rm /etc/sysctl.d/99-disable-ipv6.conf
sudo sysctl --system

Or set the values to 0:

sudo sysctl net.ipv6.conf.all.disable_ipv6=0
sudo sysctl net.ipv6.conf.default.disable_ipv6=0

When This Applies

This fix is specifically for environments where:

  • IPv6 is configured but not fully functional
  • Your ISP or network doesn't properly support IPv6
  • There's an IPv6/IPv4 fallback race condition

If your network properly supports IPv6, you likely won't encounter this issue.