- Home
- Claude Code Proxy
- Troubleshooting
Troubleshooting
Common Issues
Section titled “Common Issues”Permission Errors (Binary)
Section titled “Permission Errors (Binary)”If the binary is not executable:
chmod +x claude-code-proxyMissing Dependencies (Binary)
Section titled “Missing Dependencies (Binary)”If you see ModuleNotFoundError when running a PyInstaller binary:
- Add the missing module to the
hiddenimportslist inclaude-proxy.spec. - Rebuild with
uv run pyinstaller claude-proxy.spec. - Check that your PyInstaller version is compatible with your Python version.
Environment Variables Not Set
Section titled “Environment Variables Not Set”Verify that the proxy can see your configuration:
env | grep -E "(OPENAI|ANTHROPIC)"If using a .env file, make sure it is in the working directory where the
proxy starts. The proxy loads .env automatically via python-dotenv.
Port Already in Use
Section titled “Port Already in Use”If port 8082 is occupied:
# Find the process using the portlsof -i :8082
# Start the proxy on a different portPORT=8083 python start_proxy.pyInsufficient Memory (Single-file Binary)
Section titled “Insufficient Memory (Single-file Binary)”The single-file PyInstaller binary decompresses to a temporary directory at startup, which requires extra memory. If you are memory-constrained, use the directory version instead.
Region Errors
Section titled “Region Errors”If you receive unsupported_country_region_territory errors from OpenAI:
- Switch to Azure OpenAI — see the Configuration Reference for setup details.
- Alternatively, use a local model with Ollama.
API Key Validation Failures
Section titled “API Key Validation Failures”If the proxy returns HTTP 401:
- Verify that the
ANTHROPIC_API_KEYin your.envmatches the key Claude Code sends in thex-api-keyheader. - If you do not need client validation, remove or comment out
ANTHROPIC_API_KEYfrom your.env.
Debugging
Section titled “Debugging”Enable Debug Logging
Section titled “Enable Debug Logging”LOG_LEVEL=DEBUG python start_proxy.pyThis produces detailed output for every request and response conversion.
Check System Logs (systemd)
Section titled “Check System Logs (systemd)”journalctl -u claude-proxy -fTest Upstream Connectivity
Section titled “Test Upstream Connectivity”The /test-connection endpoint sends a minimal request to your upstream
provider and reports success or failure:
curl http://localhost:8082/test-connectionHealth Check
Section titled “Health Check”curl http://localhost:8082/healthThe response includes configuration status, whether the API key is valid, whether client validation is enabled, and the active search provider.
Running Tests
Section titled “Running Tests”End-to-end Test Script
Section titled “End-to-end Test Script”python src/test_claude_to_openai.pyThis sends a real request through the proxy and confirms the full request/response pipeline works.
Unit and Integration Tests
Section titled “Unit and Integration Tests”uv run pytest tests/ -vLint Check
Section titled “Lint Check”uv run ruff check .uv run ruff format --check .