📡

Codex: Connection Failed, Error Sending Request

'Reconnecting... waiting for network' followed by 'Connection failed: error sending request' means Codex could not even get its request to OpenAI's servers. Unlike the 'Reconnecting 1/5' messages, which mean a stream broke midway, this one appears when the connection itself cannot be made, and Codex keeps waiting with growing intervals until it can. The confusing part is that your browser and ChatGPT often work fine at the same time. That is because Codex makes its own connections to OpenAI's endpoints, and anything that treats those differently (a corporate proxy, TLS inspection with a private certificate, a VPN, DNS filtering, or a firewall rule for the Codex binary) will block Codex while the browser carries on. A Codex GitHub issue also documents that the CLI shows the same 'waiting for network' text for some local failures, such as a very large session stalling on disk, so it is not always the network. Work through the checks below from the network outward.

Recommended toolLovableBuild apps and websites by chatting, no coding required.Start building

Affiliate link, we may earn a commission at no extra cost to you.

Symptoms You Might See

⚠️

Codex shows 'Reconnecting... waiting for network' and never connects

⚠️

The final error is 'Connection failed: error sending request' or 'error sending request for url'

⚠️

ChatGPT in the browser works at the same time

⚠️

It only happens at work, on a VPN, or inside WSL or a container

⚠️

It happens on one very long session but not on a fresh one

Common Causes

Proxy or TLS inspection

Corporate networks often route traffic through a proxy that re-signs HTTPS with a private certificate. Browsers trust it through the system store, but Codex needs to be told about that certificate, otherwise its requests fail.

VPN, firewall or security software

A VPN, endpoint protection or a per-application firewall rule can block the Codex process specifically while allowing the browser.

DNS or IPv6 problems

If OpenAI's hostnames do not resolve, or resolve to an IPv6 route that does not work on your network, the request cannot be sent.

WSL, containers and remote machines

Codex running inside WSL, Docker or over SSH uses that environment's network and DNS, which may differ from the host where the browser works.

A very large local session

A Codex issue explains the CLI prints 'waiting for network' for any failure to send, including timeouts caused by heavy local disk activity on very large session files.

Step-by-Step Fixes

1

Check status and try another network

When to try: First

Look at status.openai.com, then try a phone hotspot or home network. If Codex connects there, the problem is your usual network's proxy, firewall or DNS.

2

Point Codex at your corporate CA certificate

When to try: At work or behind a corporate proxy

If your network uses TLS inspection, set CODEX_CA_CERTIFICATE to the path of the PEM bundle for your company's root certificate (Codex falls back to SSL_CERT_FILE), then restart Codex. OpenAI documents this for corporate proxies.

3

Configure or bypass the proxy

When to try: When a proxy is required on your network

Set HTTPS_PROXY (and HTTP_PROXY if needed) in the environment Codex runs in, or ask IT to allow chatgpt.com and api.openai.com, including WebSocket traffic on port 443.

4

Check DNS from the same environment

When to try: Inside WSL, Docker or remote shells

From the terminal where Codex runs, test that chatgpt.com resolves and is reachable (for example curl -I https://chatgpt.com). In WSL or containers, fix that environment's DNS settings rather than the host's.

5

Disable VPN or allow Codex through security software

When to try: When it fails only with VPN or security tools on

Pause the VPN or add an exception for the Codex app and CLI in your firewall or endpoint protection, then retry.

6

Start a fresh session

When to try: When a fresh session works

If only one huge, long-running session shows the error, close other Codex sessions and start a new one with a short checkpoint. That rules out the local-stall case.

7

Update and sign in again

When to try: When nothing else changed it

Update Codex and the IDE extension, restart them, then run codex logout and codex login. This is the sequence suggested on the OpenAI developer forum for persistent connection failures.

How to Prevent This

✓

Set CODEX_CA_CERTIFICATE once on machines behind TLS inspection

✓

Keep Codex and the IDE extension updated

✓

Use new sessions per task instead of one enormous session

✓

Ask IT to allowlist OpenAI endpoints including WebSocket traffic

When to Contact Support

Report it if Codex cannot connect on several networks with no proxy, VPN or incident. Use /feedback if the app still opens, and include your Codex version, OS, whether you use WSL or a container, and the exact error lines.

Frequently Asked Questions

Why does ChatGPT work but Codex says waiting for network?▼

Codex makes its own connections from the CLI or app, so proxies, certificates, VPNs and firewall rules can block it while your browser works. Test on another network to confirm.

What does 'error sending request' mean?▼

Codex could not send its request to OpenAI at all. It covers DNS failures, refused connections, timeouts and, in some versions, local stalls, so it is broader than a simple internet outage.

How do I use Codex behind a corporate proxy?▼

Set HTTPS_PROXY for the proxy and CODEX_CA_CERTIFICATE to your company's root certificate if it inspects TLS, then restart Codex and sign in again.

Does Codex work in WSL?▼

Yes, but it uses WSL's own network and DNS. If Codex fails only in WSL, fix DNS or proxy settings inside WSL.

Is 'Reconnecting 1/5' the same problem?▼

No. The numbered reconnects mean an existing stream broke and is being retried. 'Waiting for network' means a new connection could not be made.

Other Common AI Errors

⚠️

ChatGPT Not Working

Service Issues

🚦

Rate Limit Exceeded

Usage Limits

📏

Context Length Exceeded

Input Limits

🔥

Model Overloaded

Service Issues

Don't stop here

What to read next

Hand-picked guides our readers explore right after this one.