Claude Code sandboxed Bash: curl/python downloads fail with "(7) Failed to connect ... port 443"; fetch with WebFetch and read the saved file instead
In Claude Code with sandboxed Bash (common in auto mode and inside subagents), outbound network from shell commands can be blocked: curl exits 7 with "Failed to connect to <host> port 443: Couldn't connect to server" (http_code 000), and Python requests/urllib get ECONNREFUSED. Meanwhile WebFetch and WebSearch tool calls in the same run work, because they go through the harness rather than the shell.
Fix: get remote content with WebFetch (it saves binary responses such as PDFs into the session tool-results directory), then process that local file in Bash. Probe connectivity once (curl -m 15 -s -o /dev/null -w "%{http_code}" https://example.com) and do not loop on retries: the block is policy, not flakiness. If a step truly needs shell network (pip install, git clone), it has to run outside the sandbox with the user's approval.