How to Fix getaddrinfo ENOTFOUND Copilot Error in Visual Studio Code

If you’re using GitHub Copilot in VS Code and see an error like this: getaddrinfo ENOTFOUND api.githubcopilot.com …it means your editor can’t reach Copilot’s API servers. In simple terms, Copilot is trying to connect to the internet, but something — usually DNS, proxy settings, or firewall restrictions — is blocking it.

In this guide, we’ll explain what causes this error and provide simple, working fixes to get Copilot running smoothly again on Windows 11 (and other platforms).

What Causes the “getaddrinfo ENOTFOUND” Copilot Error?

Here’s what typically triggers this problem:

  • DNS or proxy misconfiguration (VS Code can’t resolve the GitHub Copilot domain).
  • Firewall or VPN blocking Copilot.
  • Offline mode or limited network access.
  • VS Code network settings pointing to an invalid proxy.
  • Corporate network restrictions preventing external API calls.

1. Verify Your Internet Connection

Before diving deeper, start with the basics.

  1. Open a browser and visit: https://githubcopilot.com
    • If it loads, your connection to Copilot’s server works fine.
    • If you get “site can’t be reached,” you have a DNS or firewall issue.
  2. Disable your VPN or proxy temporarily and retry.

Pro Tip: GitHub Copilot requires an active, unrestricted internet connection — especially on corporate or school networks.

2. Clear VS Code Proxy Settings

If you use a custom proxy, VS Code might still be trying to use old or invalid settings.

  1. Open VS Code.
  2. Press Ctrl + Shift + P, then search for: Preferences: Open Settings (JSON)
  3. Look for any http.proxy or https.proxy lines like:
    "http.proxy": "http://127.0.0.1:8080",
    "https.proxy": "http://127.0.0.1:8080",
  4. Either delete these lines or comment them out.
  5. Save the file and restart VS Code.

Alternative: You can also reset proxy settings through the command palette by typing:

> GitHub Copilot: Reset Connection

3. Flush Your DNS Cache

If your system’s DNS cache is outdated, VS Code might fail to resolve api.githubcopilot.com.

  1. Press Windows + R, type cmd, and run it as Administrator.
  2. Enter this command: ipconfig /flushdns
  3. Wait until you see “Successfully flushed the DNS Resolver Cache.”
  4. Restart your computer and reopen VS Code.

Why this works: It clears old DNS entries that may be preventing domain resolution.

4. Check Windows Firewall or Antivirus

Firewall or antivirus tools can sometimes block outgoing connections from VS Code or the Node.js runtime Copilot uses.

  1. Open Windows Security → Firewall & network protection → Allow an app through firewall.
  2. Click Change settingsAllow another app.
  3. Add these two if missing:
    • Code.exe (VS Code executable)
    • node.exe (Node.js runtime used by extensions)
  4. Allow both for Private and Public networks.

Pro Tip: If you’re on a corporate network, contact your IT department — they might need to whitelist GitHub Copilot’s API domain.

5. Check Your System Proxy or Environment Variables

If you’re using a system-wide proxy, Copilot might be routed through an incorrect address.

  1. Open Control Panel → Internet Options → Connections tab → LAN settings.
  2. If “Use a proxy server” is checked, disable it temporarily.
  3. Open Command Prompt and run: set | find "HTTP"
  4. If you see environment variables like HTTP_PROXY or HTTPS_PROXY, clear them by running:
    setx HTTP_PROXY ""
    setx HTTPS_PROXY ""
  5. Restart VS Code.

6. Update or Reinstall GitHub Copilot Extension

Outdated extensions may cause connection issues.

  1. In VS Code, press Ctrl + Shift + X to open Extensions.
  2. Search for GitHub Copilot.
  3. Click the gear icon → Uninstall.
  4. Restart VS Code.
  5. Reinstall from the Visual Studio Marketplace.

After reinstalling, sign in again and test Copilot.

7. Check Copilot Logs for Details

VS Code keeps detailed logs that can help you pinpoint the problem.

  1. Press Ctrl + Shift + P → search for: Developer: Toggle Developer Tools
  2. Go to the Console tab.
  3. Look for lines mentioning: getaddrinfo ENOTFOUND api.githubcopilot.com
  4. If this repeats, the issue is likely DNS or firewall related.

Tip: Try switching networks (e.g., mobile hotspot) to confirm.

8. Use Alternate DNS Servers (Google or Cloudflare)

If your ISP’s DNS is unreliable, using a global resolver can help.

  1. Press Windows + I → Network & Internet → Adapter Options.
  2. Right-click your connection → Properties → select Internet Protocol Version 4 (TCP/IPv4)Properties.
  3. Choose Use the following DNS server addresses and enter:
    • Preferred DNS: 8.8.8.8
    • Alternate DNS: 8.8.4.4
  4. Click OK and restart VS Code.

Alternative DNS:
Cloudflare’s 1.1.1.1 and 1.0.0.1 also work great.

9. Check Node.js or NPM Path (Advanced Fix)

GitHub Copilot runs through Node.js internally. If Node isn’t found or is outdated, Copilot may fail to connect.

  1. Press Ctrl + Shift + P → Developer: Open Process Explorer.
  2. Check if node.exe is running for Copilot.
  3. If missing, reinstall Node.js from https://nodejs.org.
  4. Ensure Node is added to your system PATH.

Test by running:

node -v

in VS Code’s terminal.

10. Disable IPv6 (Last Resort)

In rare cases, IPv6 resolution conflicts can cause ENOTFOUND errors.

  1. Press Windows + R → type ncpa.cpl → Enter.
  2. Right-click your network → Properties.
  3. Uncheck Internet Protocol Version 6 (TCP/IPv6).
  4. Click OK and restart your PC.

Then try using Copilot again.

Wrapping Up

The “getaddrinfo ENOTFOUND” Copilot error might seem technical, but it simply means VS Code can’t reach GitHub’s Copilot servers.

By checking your network settings, clearing proxy configurations, flushing DNS, and ensuring Copilot isn’t blocked by a firewall, you can quickly restore your AI assistant to full functionality.

Once fixed, GitHub Copilot will go back to suggesting code in real-time — helping you write smarter, faster, and more efficiently.

Posted by Arpita

With a background in Computer Science, she is passionate about sharing practical programming tips and tech know-how. From writing clean code to solving everyday tech problems, she breaks down complex topics into approachable guides that help others learn and grow.