Error Handling
When a command fails, the CLI returns a non-zero exit code. If you’re using--json or --agent output mode, the envelope’s ok field is false and the summary field contains the error message.
Error envelope
Common errors
| Error summary | Cause | Resolution |
|---|---|---|
| ”Not logged in” | No stored credentials found | Run nexudus login to authenticate |
| ”Unauthorized” | Invalid or expired credentials | Run nexudus login again with correct credentials |
| ”Forbidden” | Your account lacks API permissions | Contact your Nexudus administrator to grant API access |
| ”not found” | The entity ID does not exist | Double-check the ID — use list to find valid IDs |
| ”Failed to create” | Validation error on create | Check required fields — run nexudus <entity> create --help for details |
| Non-zero exit code | General command failure | Read stderr or the JSON envelope for details |
Checking for errors in scripts
When scripting, always check the exit code or parse the envelope:Diagnostics
If you’re unsure why commands are failing, run diagnostics:- Whether credentials are stored and valid.
- Whether the API is reachable.
- Whether the CLI is up to date.