This guide helps diagnose and fix common issues with fetch.
fetch uses exit codes to indicate the result of a request:
| Exit Code | Meaning |
|---|---|
| 0 | Success (HTTP 2xx-3xx) |
| 4 | Client error (HTTP 4xx) |
| 5 | Server error (HTTP 5xx) |
| 6 | Other HTTP status or request error |
To always exit 0 regardless of HTTP status:
fetch --ignore-status example.com/not-found
echo $? # Always 0 if request completedfetch -v example.comShows:
- HTTP version and status
- Response headers
fetch -vv example.comShows:
>prefixed request lines<prefixed response lines
fetch -vvv example.comShows:
>prefixed request lines*prefixed connection info (DNS, TCP, TLS, TTFB)<prefixed response lines
Preview the request without sending:
fetch --dry-run -m POST -j '{"test": true}' example.comShows:
- Complete request that would be sent
- Headers and body
- Useful for debugging authentication and body formatting
Symptom: "certificate signed by unknown authority" or similar
Causes:
- Self-signed certificate
- Expired certificate
- Wrong hostname
- Missing intermediate certificates
- Corporate SSL inspection
Solutions:
-
For development/testing only:
fetch --insecure https://self-signed.example.com
-
Add custom CA certificate:
fetch --ca-cert /path/to/ca.crt https://internal.example.com
-
Check certificate details:
fetch -vvv https://example.com 2>&1 | grep -i tls
-
Verify certificate externally:
openssl s_client -connect example.com:443 -showcerts
Symptom: Request hangs or "context deadline exceeded"
Causes:
- Server unreachable
- Firewall blocking connection
- DNS resolution failure
- Slow server response
Solutions:
-
Set explicit timeout:
fetch --timeout 10 example.com
-
Test DNS resolution:
fetch --dns-server 8.8.8.8 -vvv example.com
-
Test network connectivity:
ping example.com curl -v example.com
Symptom: "connection refused"
Causes:
- Server not running
- Wrong port
- Firewall blocking
Solutions:
- Verify the URL and port
- Check if service is running:
nc -zv example.com 443
Symptom: "no such host" or DNS errors
Solutions:
-
Try alternative DNS:
fetch --dns-server 8.8.8.8 example.com fetch --dns-server https://1.1.1.1/dns-query example.com
-
Verify hostname:
nslookup example.com dig example.com
Symptom: Connection errors when using proxy
Solutions:
-
Verify proxy URL format:
fetch --proxy http://proxy:8080 example.com fetch --proxy socks5://proxy:1080 example.com
-
Test without proxy:
unset HTTP_PROXY HTTPS_PROXY fetch example.com -
Check proxy authentication:
fetch --proxy http://user:pass@proxy:8080 example.com
Symptom: "http2: server sent GOAWAY" or protocol errors
Solutions:
-
Force HTTP/1.1:
fetch --http 1 example.com
-
Check server HTTP/2 support:
curl --http2 -v example.com 2>&1 | grep -i alpn
Symptom: gRPC calls failing
Common issues:
-
Method not found:
- Check URL path format:
/package.Service/Method - Verify proto schema includes the method
- Check URL path format:
-
Proto compilation fails:
- Install
protoc:brew install protobuf - Check import paths:
--proto-import
- Install
-
JSON conversion errors:
- Verify JSON field names match proto (use snake_case)
- Check types: strings must be quoted
# Debug gRPC request
fetch --grpc --proto-file service.proto \
-j '{"field": "value"}' \
--dry-run \
https://localhost:50051/pkg.Service/MethodSymptom: Images show as raw bytes or don't display
Solutions:
-
Check terminal support:
- Use Kitty, iTerm2, WezTerm, or Ghostty for best results
-
Force native decoding:
fetch --image native example.com/image.png
-
Install image adapters:
brew install vips imagemagick ffmpeg
-
Disable image rendering:
fetch --image off example.com/image.jpg
Symptom: "the response body appears to be binary"
Solutions:
-
Save to file:
fetch -o output.bin example.com/file.bin
-
Force output to stdout:
fetch -o - example.com/file.bin > output.bin
Symptom: Response appears cut off
Info: Formatting is limited to 16MB of data
Solutions:
-
Save to file (no size limit):
fetch -o large-response.json example.com/large
-
Disable formatting:
fetch --format off example.com/large
-
Check location:
- Windows:
%AppData%\fetch\config - macOS/Linux:
~/.config/fetch/config
- Windows:
-
Specify explicitly:
fetch --config /path/to/config example.com
-
Validate syntax:
- Check for error messages on stderr
- Verify INI format
Precedence (highest to lowest):
- Command-line flags
- Host-specific config
- Global config
- Defaults
Use dry-run to verify:
fetch --dry-run example.comfetch --version
fetch --buildinfofetch --helpIf you encounter a bug:
-
Gather debug output:
fetch -vvv example.com 2>&1 -
Note your environment:
fetch --buildinfo uname -a
-
Report at: https://github.com/ryanfowler/fetch/issues
- CLI Reference - All options and flags
- Configuration - Config file format
- Advanced Features - Network options