Overview
Thedoctor command runs comprehensive diagnostic checks on your Paperclip installation. It validates configuration, tests connections, verifies file permissions, and can automatically repair common issues.
Syntax
Options
--config <path>
Path to config file to check.
Default: ~/.paperclip/instances/default/config.json
--data-dir <path>
Paperclip data directory root.
--repair
Attempt to repair issues automatically.
--fix
Alias for --repair.
--yes / -y
Skip repair confirmation prompts. Auto-confirm all repairs.
Health Checks
Doctor runs these checks in order:1. Config File
Validates configuration file exists and is readable. Pass:2. Deployment/Auth Mode
Verifies deployment mode and auth configuration are consistent. Valid combinations:local_trusted+ any exposureauthenticated+privateorpublic
3. Agent JWT Secret
Checks forPAPERCLIP_AGENT_JWT_SECRET in environment or .env.local file.
Pass:
.env.local
4. Secrets Adapter
Validates secrets configuration and key file. Pass:5. Storage Adapter
Verifies storage configuration and paths. Pass (local_disk):6. Database
Tests database connectivity and configuration. Pass (embedded-postgres):7. LLM Provider
Validates LLM configuration if present. Pass:8. Log Directory
Verifies log directory exists and is writable. Pass:9. Server Port
Checks if configured port is available. Pass:Output Format
Status Icons
- ✓ (green) - Check passed
- ! (yellow) - Warning (non-blocking)
- ✗ (red) - Check failed (may block startup)
Check Result
Each check shows:Summary
At the end:- All passed:
All checks passed!(green) - Warnings only:
All critical checks passed with some warnings.(yellow) - Failures:
Some checks failed. Fix the issues above and re-run doctor.(red)
Auto-Repair
Interactive Repair
With--repair (no --yes):
Non-Interactive Repair
With--repair --yes:
Repair Actions
Doctor can automatically:- Generate JWT secret - Creates new secret in
.env.local - Create secrets key - Generates master encryption key
- Create directories - Makes missing log, storage, or database directories
- Fix permissions - Ensures directories are writable (if possible)
Examples
Basic health check
Check and repair
Fully automated repair
Check specific config
Pre-deployment check
Exit Codes
Doctor returns:- 0 - All checks passed (or only warnings)
- 1 - One or more checks failed
Integration with Other Commands
Used by run
The run command automatically calls doctor:
After onboard
Recommended to verify setup:
Before configure
Check current state:
Troubleshooting
All checks fail with “Config file not found”
Solution: Run onboard first:Database check fails
For embedded-postgres:Port check warns “in use”
Find what’s using the port:LLM provider check fails
Update API key:Secrets key file check fails
Auto-create:Storage directory check fails
Auto-create:Permission errors during repair
Run with proper permissions:CI/CD Integration
Pre-deployment Health Check
GitHub Actions
Docker Health Check
Best Practices
Regular Health Checks
Run doctor periodically:After Configuration Changes
Always verify after changes:Before Production Deploy
Validate staging environment:Monitor Exit Code
In scripts:Next Steps
Fix configuration
Update configuration sections
Start server
Run Paperclip after repairs
Re-run setup
Go through onboarding again