Summary
A
Typical error:
httpx.ConnectTimeout means the TCP connection to the server wasn't established within the connect timeout. The SDK's default is 10 s. The request never reached the Planet API, so this is not an application error. The usual causes are on the network path or the client side. They are rarely an API problem.Typical error:
httpx.ConnectTimeout (TCP connect to api.planet.com:443, connect timeout 10 s)How to tell the error types apart
| Error | Meaning | Likely cause |
|---|---|---|
ConnectTimeout | TCP handshake not completed | Network path, NAT or firewall limits, DNS, client overload, rarely an edge issue |
ReadTimeout | Connected, but no response in time | Slow API response or large payload |
PoolTimeout | No free connection in the client pool | Too much concurrency for the pool size |
| HTTP 429 | Rate limited by the API | Too many requests per second. It is a normal response, not a timeout. |
| HTTP 5xx | Server-side error | Report to Planet Support |
Rate limiting at the API level shows up as HTTP 429, not as a connect timeout. Network-level throttling, such as a firewall or WAF dropping connections, can look like a connect timeout.
Common causes
- NAT or SNAT exhaustion. Containers, cloud VMs, and office networks usually reach the internet through one or more NAT devices. Each outbound connection uses a source port on the NAT's public IP. If the NAT's session table or port pool fills up, new connections are dropped or delayed. This is common with many concurrent jobs or a shared egress IP. Checking only the host's conntrack table is not enough when there is a second NAT, such as an office router or cloud NAT gateway.
- Local port or file descriptor exhaustion. Many short-lived connections can use up ephemeral ports or the open-file limit (
ulimit -n). - Slow or failing DNS. In httpx, name resolution happens inside the connect phase, so a slow resolver can show up as
ConnectTimeout. - Event loop starvation. Thousands of concurrent tasks in one Python process can delay connection handling.
- Firewall, proxy, VPN, or ISP issues. Packet loss, SYN filtering, or a congested uplink.
- Platform-side events. An incident or edge or load balancer problem. Check the Planet status page, and contact Support to have logs checked.
A useful clue is failures at nearly the same moment across different hosts, such as api.planet.com and link.planet.com, or across separate processes. That points to a shared cause, such as the uplink, NAT, or DNS, and not to a single script.
Diagnostic steps
- Record exact timestamps (UTC), the target host, and the SDK, Python, and httpx versions. Check whether failures cluster in time.
- Check the Planet status page for incidents in that window.
- Reproduce from the same host:
curl -v --connect-timeout 10 https://api.planet.commtr -rw api.planet.com - Test DNS. Time the lookup (
dig api.planet.com) and compare with a fixed resolver such as1.1.1.1. - Capture traffic during a run:
tcpdump -i any -nn 'tcp port 443 and host api.planet.com'- SYNs go out but no SYN-ACK returns: the problem is in transit or at the NAT.
- SYNs never leave the host: the problem is local.
- Check every NAT hop, including the Docker host, office router or firewall, and cloud NAT gateway. Look at session counts, drops, and CPU. On Linux:
conntrack -Ccat /proc/sys/net/netfilter/nf_conntrack_max - Check local limits:
ulimit -nandss -s. - Run the same job from a different network, such as a cloud VM, and compare failure rates.
Mitigations
- Limit concurrency. The SDK already caps requests at 10 per second and 50 concurrent HTTP requests. Having thousands of orders in flight at once can still stress the client. Use a semaphore or a work queue to limit how many orders are active.
- Reuse one
planet.Sessionfor all orders in a job. Don't create one per request. - Retry
ConnectTimeoutin your own code, with exponential backoff and jitter. The connection never opened, so the request was never sent. That makes a retry safe, even for thePOSTthat creates an order. The SDK retries some errors itself (connection errors, read timeouts, HTTP 429 and 502), but notConnectTimeout, so retry it in your own code. - Handle interrupted downloads separately. If the connection closes mid-download, retry the whole download or resume it. Don't treat it as a connect problem.
- Spread the load across more egress IPs or NAT gateways, or increase NAT capacity.
- Raise the connect timeout (optional). The SDK's session fixes the connect timeout at 10 s, and only the read timeout is configurable. The SDK has no option to change it. Overriding the underlying httpx client's timeout relies on private attributes and may break between SDK versions. Raising the timeout hides the symptom but doesn't fix the cause. Prefer the other mitigations.
When to contact Planet Support
Open a ticket if the errors continue after the checks above, or if you see failures across multiple unrelated networks. Please include:
- Exact UTC timestamps of each failure
- Your public egress IP(s)
- Target hostnames (for example, api.planet.com or link.planet.com)
- SDK, Python, and httpx versions, and the full traceback
- Concurrency level and job size
- Results of
curl,mtr, and DNS tests - Whether other error types (such as 5xx) occurred in the same period
Support can then check edge, load balancer, and WAF logs for your IP at those times.
Comments
Please sign in to leave a comment.