Common issues and solutions for Pup CLI.
Symptoms:
Error: failed to complete OAuth login
Common causes:
-
Network connectivity
# Test connectivity to Datadog curl -I https://datadoghq.com # Check DNS resolution nslookup datadoghq.com
-
Firewall blocking localhost
- Callback server needs to bind to
127.0.0.1:<random-port> - Check firewall allows connections to localhost
- Try temporarily disabling firewall
- Callback server needs to bind to
-
Browser doesn't open
⚠️ Could not open browser automatically Please open this URL manually: https://...- Copy URL and paste in browser manually
- Check
$BROWSERenvironment variable - Try setting:
export BROWSER=chrome
-
Port already in use
- CLI automatically tries random available port
- If error persists, check for port conflicts:
# List processes listening on local ports lsof -i -P | grep LISTEN | grep 127.0.0.1
Solutions:
# Try with verbose logging
pup --verbose auth login
# Specify site explicitly
pup --site=datadoghq.com auth login
# Check authentication status
pup auth statusSymptoms:
Error: failed to refresh access token
⚠️ Token expired. Run 'pup auth refresh' or 'pup auth login'
Causes:
- Refresh token expired (30-day lifetime)
- Network connectivity lost
- OAuth client revoked
- Invalid stored tokens
Solutions:
# Try manual refresh
pup auth refresh
# If refresh fails, re-authenticate
pup auth logout
pup auth login
# Check stored tokens (debug only)
ls -la ~/.config/pup/tokens_*.jsonmacOS symptoms:
Warning: keychain access denied, using encrypted file storage
Solutions:
-
Grant keychain access:
- Open "Keychain Access" app
- Search for "pup"
- Right-click → "Get Info"
- Grant access to pup binary
-
Use fallback storage:
- Pup automatically falls back to encrypted file
- Check:
~/.config/pup/tokens.enc - File permissions should be
0600
Symptoms:
Error: authentication failed: 403 Forbidden
Check environment variables:
# Verify keys are set
echo $DD_API_KEY
echo $DD_APP_KEY
echo $DD_SITE
# Set if missing
export DD_API_KEY="your-api-key"
export DD_APP_KEY="your-app-key"
export DD_SITE="datadoghq.com"Validate keys:
# Test with curl
curl -X GET "https://api.datadoghq.com/api/v1/validate" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"Symptoms:
Error: 429 Too Many Requests
Rate limit exceeded
Solutions:
- Wait before retrying
- Reduce number of concurrent requests
- Check your Datadog plan limits
- Use pagination with smaller page sizes
Workaround:
# Add delay between requests
for id in $(cat ids.txt); do
pup monitors get "$id"
sleep 1 # Wait 1 second between requests
doneSymptoms:
Error: context deadline exceeded
Error: request timeout
Causes:
- Network latency
- Large result set
- Datadog API slow response
Solutions:
# Use pagination
pup monitors list --limit=100
# Use shorter time ranges
pup logs search --query="..." --from="30m" # Instead of 24h
# Check network latency
ping api.datadoghq.comSymptoms:
Error: 404 Not Found
Resource not found: monitor 12345678
Causes:
- Resource deleted
- Wrong resource ID
- Wrong Datadog site
- Insufficient permissions
Solutions:
# Verify resource exists
pup monitors list | grep "12345678"
# Check you're on correct site
pup --verbose monitors get 12345678
# Try with different site
pup --site=datadoghq.eu monitors get 12345678Symptoms:
Error: unknown command "foo" for "pup"
Solutions:
# List available commands
pup --help
# Check command spelling
pup metrics --help
# Verify command exists
pup help metrics querySymptoms:
Error: unknown flag: --foo
Solutions:
# Check available flags
pup metrics query --help
# Common flag mistakes:
pup metrics query --query="..." --from="1h" # Correct
pup metrics query -query="..." -from="1h" # Wrong (single dash)Symptoms:
Error: required flag "query" not set
Solutions:
# Check required flags in help
pup metrics query --help
# Provide required flags
pup metrics query --query="avg:system.cpu.user{*}" --from="1h"Symptoms:
# go build
./cmd/foo.go:123: undefined: SomeType
Solutions:
# Clean and rebuild
go clean
go mod tidy
go build -o pup .
# Update dependencies
go get -u github.com/DataDog/datadog-api-client-go/v2
go mod tidySymptoms:
go: missing go.sum entry for module
Solutions:
# Download missing dependencies
go mod download
# Regenerate go.sum
go mod tidy
# Verify module checksums
go mod verifySymptoms:
FAIL: TestSomething
Solutions:
# Run tests with verbose output
go test -v ./...
# Run specific test
go test -v ./pkg/auth/... -run TestOAuthFlow
# Run with race detection
go test -race ./...
# Check test coverage
go test -cover ./...Symptoms:
Error: invalid character '<' looking for beginning of value
Causes:
- HTML error response instead of JSON
- API returned non-JSON
- Corrupted response
Solutions:
# Check raw response
pup --verbose monitors list
# Try different output format
pup monitors list --output=yamlSymptoms:
- Columns misaligned
- Text truncated
- Wide output
Solutions:
# Use JSON for complete output
pup monitors list --output=json | jq .
# Specify custom fields
pup monitors list --fields="id,name,status"
# Use YAML for readability
pup monitors list --output=yamlCauses:
- Large result sets
- Wide time ranges
- Network latency
- Datadog API slow response
Solutions:
# Use pagination
pup monitors list --limit=50
# Narrow time range
pup logs search --from="30m" # Instead of 24h
# Filter results
pup monitors list --tag="env:prod" # Instead of allCauses:
- Loading large result sets
- Not using pagination
- Processing too much data
Solutions:
# Use streaming/pagination
pup monitors list --limit=100
# Process in batches
for page in {0..10}; do
pup monitors list --offset=$((page * 100)) --limit=100
doneEnable verbose logging to troubleshoot issues:
# Global verbose flag
pup --verbose <command>
# Set log level via env var
export PUP_LOG_LEVEL=debug
pup <command>
# Trace HTTP requests
export DD_DEBUG=true
pup --verbose <command>Verbose output includes:
- HTTP request details
- API endpoint URLs
- Authentication method used
- Response status codes
- Error stack traces
Check locations:
# Default location
ls -la ~/.config/pup/config.yaml
# Custom location
pup --config=/path/to/config.yaml <command>
# Verify config syntax
cat ~/.config/pup/config.yaml | yq .Precedence order:
- Command flags (highest)
- Environment variables
- Config file
- Defaults (lowest)
Debug config:
# Show resolved config
pup --verbose auth status
# Check env vars
env | grep DD_
env | grep PUP_-
Check command help:
pup --help pup metrics --help pup metrics query --help
-
Read documentation:
-
Check API docs:
When opening a GitHub issue, include:
-
Pup version:
pup --version
-
Command that failed:
pup --verbose <command>
-
Environment info:
# OS version uname -a # Go version go version # Environment variables (redact keys!) env | grep DD_SITE
-
Error message and stack trace
-
Steps to reproduce
-
Expected vs actual behavior
- GitHub Issues: github.com/DataDog/pup/issues
- Datadog Community: community.datadoghq.com
Only for testing with self-signed certs:
export DD_SKIP_SSL_VALIDATION=true
pup <command>export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
pup <command>For testing or custom deployments:
export DD_HOST=https://custom-api.example.com
pup <command>