Error Codes Reference
CCS uses standardized exit codes for consistent error handling. This reference covers all exit codes, their meanings, recovery strategies, and debugging techniques.Exit Code Summary
| Code | Name | Recoverable | Severity | Common Causes |
|---|---|---|---|---|
| 0 | SUCCESS | N/A | Success | Normal execution |
| 1 | GENERAL_ERROR | No | Error | Unspecified errors |
| 2 | CONFIG_ERROR | No | Error | Config file issues |
| 3 | NETWORK_ERROR | Yes | Warning | Connection failures |
| 4 | AUTH_ERROR | No | Error | Authentication failures |
| 5 | BINARY_ERROR | No | Error | CLIProxy binary issues |
| 6 | PROVIDER_ERROR | Yes | Warning | Provider API errors |
| 7 | PROFILE_ERROR | No | Error | Profile not found |
| 8 | PROXY_ERROR | No | Error | Proxy startup failures |
| 9 | MIGRATION_ERROR | No | Error | Config migration failures |
| 130 | USER_ABORT | No | Info | User interrupted (Ctrl+C) |
Detailed Error Codes
Exit Code 0: SUCCESS
Name:SUCCESS
Recoverable: N/A
Severity: Success
Description:
Command completed successfully without errors.
Examples:
Exit Code 1: GENERAL_ERROR
Name:GENERAL_ERROR
Recoverable: No
Severity: Error
Description:
Unspecified error that doesn’t fit other categories. Often indicates bugs or unexpected conditions.
Common Causes:
- Unhandled exceptions
- Logic errors in code
- Unexpected state
- Enable debug mode:
CCS_DEBUG=1 ccs <command> - Check stack trace for root cause
- Report bug if issue persists
Exit Code 2: CONFIG_ERROR
Name:CONFIG_ERROR
Recoverable: No
Severity: Error
Description:
Configuration file is invalid, corrupted, or has schema errors.
Common Causes:
- Invalid YAML syntax
- Schema version mismatch
- Missing required fields
- Invalid field values
- Corrupted config file
- Validate syntax:
ccs doctor - Auto-repair:
ccs doctor --fix - Manual edit: Fix syntax in
~/.ccs/config.yaml - Reset config: Delete
~/.ccs/config.yamland runccs setup
Exit Code 3: NETWORK_ERROR
Name:NETWORK_ERROR
Recoverable: Yes
Severity: Warning
Description:
Network connection failed. Retry may succeed if network is restored.
Common Causes:
- No internet connection
- Remote proxy unreachable
- DNS resolution failure
- Firewall blocking connection
- Timeout exceeded
- Check network: Verify internet connection
- Test connectivity:
ping <proxy-host> - Increase timeout:
--proxy-timeout 10000 - Use local fallback: Remove
--remote-onlyflag - Retry: Re-run command after network restored
Exit Code 4: AUTH_ERROR
Name:AUTH_ERROR
Recoverable: No
Severity: Error
Description:
Authentication or authorization failed. Requires user intervention to fix credentials.
Common Causes:
- OAuth token expired/revoked
- Invalid API key
- Missing authentication
- Wrong credentials
- Account suspended
- Re-authenticate:
ccs <profile> --auth - Check credentials: Verify API keys in config
- Logout and login:
ccs <profile> --logoutthen--auth - Add new account:
ccs <profile> --auth --add - Check provider status: Verify account is active
Exit Code 5: BINARY_ERROR
Name:BINARY_ERROR
Recoverable: No
Severity: Error
Description:
CLIProxyAPI binary is missing, corrupted, or incompatible.
Common Causes:
- Binary not installed
- Binary corrupted
- Version mismatch
- Permission denied
- Unsupported platform
- Reinstall binary:
ccs cliproxy install --force - Check version:
ccs cliproxy version - Verify permissions:
chmod +x ~/.ccs/cliproxy/bin/CLIProxyAPI - Platform check: Ensure platform is supported
- Clean install: Delete
~/.ccs/cliproxy/bin/and reinstall
Exit Code 6: PROVIDER_ERROR
Name:PROVIDER_ERROR
Recoverable: Yes
Severity: Warning
Description:
Provider API returned an error. May be temporary (rate limiting, maintenance).
Common Causes:
- Rate limiting
- Provider API down
- Quota exceeded
- Invalid request
- Provider-side issues
- Retry: Wait and re-run command
- Check status: Visit provider status page
- Switch provider: Use alternative provider
- Check quota: Verify API usage limits
- Report issue: Contact provider support if persistent
Exit Code 7: PROFILE_ERROR
Name:PROFILE_ERROR
Recoverable: No
Severity: Error
Description:
Profile name not found or invalid.
Common Causes:
- Profile doesn’t exist
- Typo in profile name
- Profile not created yet
- Reserved profile name
- List profiles:
ccs auth listorccs api list - Check spelling: Verify profile name
- Create profile:
ccs auth createorccs api create - Check config: Edit
~/.ccs/config.yamlif needed
Exit Code 8: PROXY_ERROR
Name:PROXY_ERROR
Recoverable: No
Severity: Error
Description:
CLIProxyAPI failed to start or crashed.
Common Causes:
- Port already in use
- Binary crashed
- Insufficient permissions
- Resource limits exceeded
- Configuration error
- Check port:
lsof -i :<port>ornetstat -an | grep <port> - Kill existing:
pkill CLIProxyAPI - Retry: Re-run command
- Check logs:
~/.ccs/cliproxy/logs/error.log - Reinstall binary:
ccs cliproxy install --force
Exit Code 9: MIGRATION_ERROR
Name:MIGRATION_ERROR
Recoverable: No
Severity: Error
Description:
Config migration from legacy format failed.
Common Causes:
- Corrupted legacy config
- Disk full
- Permission denied
- Conflicting profiles
- Invalid legacy data
- Rollback:
ccs migrate --rollback - Dry run:
ccs migrate --dry-runto preview - Manual migration: Edit config files manually
- Fresh start: Delete
~/.ccs/and runccs setup - Restore backup: Copy from
~/.ccs/backup-v1-*/
Exit Code 130: USER_ABORT
Name:USER_ABORT
Recoverable: No
Severity: Info
Description:
User interrupted execution with Ctrl+C (SIGINT).
Common Causes:
- User pressed Ctrl+C
- Process killed by signal
- Terminal closed
- None needed (intentional user action)
Error Handling Utilities
Check Exit Code
Debug Mode
Enable verbose error output:Recoverable Errors
Exit codes 3 and 6 are recoverable. Retry logic:Common Error Patterns
Pattern: OAuth Flow Failures
Exit Code: 4 (AUTH_ERROR) Symptoms:- Browser doesn’t open
- Token refresh fails
- “Authentication required” message
Pattern: Remote Proxy Issues
Exit Codes: 3 (NETWORK_ERROR), 8 (PROXY_ERROR) Symptoms:- “Connection refused”
- “Timeout exceeded”
- “Proxy unreachable”
Pattern: Config Corruption
Exit Code: 2 (CONFIG_ERROR) Symptoms:- “Invalid YAML syntax”
- “Schema validation failed”
- “Unsupported version”
Troubleshooting Workflow
- Read error message - Often contains fix instructions
- Enable debug mode -
CCS_DEBUG=1for details - Check exit code - Determines if recoverable
- Run doctor -
ccs doctorfor health check - Check logs -
~/.ccs/cliproxy/logs/error.log - Consult docs - Provider-specific guides
- Report bug - If issue persists, open GitHub issue
