Identify the Perplexity product and operation before interpreting an error. Use safe status details to separate account access, request validation, capacity and a response parser that expects the wrong contract.
Error format at Perplexity
The native SDK distinguishes connection, timeout and API status failures. An API status error provides response context, while a transport failure may have no provider JSON body. The official error guide documents these categories and the safe information useful for diagnosis. Official Perplexity documentation.
Record the endpoint, operation, selected model or preset, time and sanitized status detail. Keep bearer credentials and private prompt content out of logs. A support issue should include a harmless minimal reproducer, not the original research material by default. A precise route label is particularly useful because Perplexity exposes several different products under the same account.
Treat an unexpected successful response separately from an HTTP rejection. If the application expects a Sonar completion choice but receives an Agent response, a missing field can be a parser mismatch rather than a failed model call. Inspect the documented structure for the method you invoked and validate it before rendering an answer.
Error code table
| HTTP status | Documented SDK category or label | Likely investigation | Next action |
|---|---|---|---|
| 400 | Bad request | Request shape or parameters | Reduce to the relevant product baseline and correct the rejected field. |
| 401 | Authentication | Missing or invalid credential | Check the process environment and intended project key. |
| 403 | Permission denied | Access or permission condition | Inspect safe response detail and project access. |
| 404 | Not found | Wrong route or unavailable resource | Check the product endpoint and exact identifier. |
| 429 | Rate limit | Admission condition | Use the product rule and a bounded delayed retry when appropriate. |
| 500+ | Server error | Temporary service failure | Check status and retry deliberately within a task deadline. |
The table uses documented HTTP labels and SDK categories, not a promise that every response contains a fixed literal sentence. Preserve the actual safe message returned by your endpoint. The cause and next action should follow that evidence rather than a guessed universal string match. Official Perplexity documentation.
Map these categories to useful application states. A user who needs to correct input should see a different action from an operator who must repair project access. An exhausted retry should preserve the unfinished task rather than present an empty answer as success. Keep the original category in monitoring even if the UI uses simpler language.
Authentication errors
Check whether the running process has PERPLEXITY_API_KEY and uses the intended project. The official key workflow begins with a project, and the value is shown only when created. Follow Perplexity API key setup if configuration or rotation is incomplete. Official Perplexity documentation.
Confirm presence without printing the secret. Check the environment used by the actual service, which can differ from an interactive terminal. After rotation, verify background workers as well as the web process. Keep a safe record of the key label and deployment time so a failure can be linked to a configuration change.
For a permission rejection, inspect the safe response detail and project role before creating more credentials. A credential that authenticates one operation does not establish access to every administrative action. If you are collaborating with an account owner, provide the required setup steps and let them configure the secret through the intended protected surface.
Rate and quota errors
Use Perplexity product-specific limits to identify the relevant admission rule. Do not apply Sonar model RPM values to Agent or Search. Inspect current account funding separately through the project billing interface; a usage tier and a usable balance are different facts. Official Perplexity documentation. Official Perplexity documentation.
For temporary rate failures, coordinate SDK and application retries so one user task does not create overlapping loops. Honor documented response timing where the selected route provides it, apply a total task deadline and keep the delayed state visible. For an account condition, stop new dispatches and preserve safe unfinished jobs for an administrative decision.
If consumption was larger than expected, use the AI API cost calculator to revisit supported token assumptions and examine additional product charges separately. A short final answer can still belong to a broader research workflow. Compare actual returned usage and project activity with the complete task, including any correction or retrieval calls.
Request validation errors
Reduce the request to the current quickstart for the selected product. Add optional fields back individually and compare the serialized request with the reference. Check that the SDK method, endpoint and body shape describe the same operation. Copying a parameter from a similarly named feature in another product is a common source of ambiguity. Official Perplexity documentation.
During Sonar migration, messages, output handling, search controls and asynchronous state need explicit mapping to Agent. The official Sonar documentation states that Sonar support continues until September 27, 2026 and directs developers to the Agent API migration guide. Official Perplexity documentation. Keep the old fixture while testing each mapped behavior. A change that fixes the first call can still leave citation rendering or a later conversation turn incorrect. Official Perplexity documentation.
For Sonar search restrictions and structured output, follow the relevant feature reference. Validate requested filter syntax and the application’s expected schema before dispatch. Then validate returned data again before storing it. A well-formed JSON object is still subject to the application’s factual and required-field checks. Official Perplexity documentation. Official Perplexity documentation.
Model and context errors
Verify the exact accepted identifier or preset in the correct product catalog. Open Perplexity model naming and migration for the Sonar records and links to current integration paths. A display label, a Sonar identifier and an Agent preset should not be used interchangeably.
If a request is too large or a completion is incomplete, inspect the full input sent by the application. Conversation history, retrieved material and repeated instructions can differ from the latest visible question. Select the relevant material and preserve the answer’s evidence requirements when reducing input. Do not silently drop sources that the application needs to justify its result.
Keep an explicit incomplete outcome when the response does not contain the required artifact. An empty text field, a cut-off structured record or citations that cannot be matched to claims require investigation even when the network operation succeeded. Count those outcomes in evaluation results rather than filtering them out as inconvenient examples.
Server errors and status
Check Perplexity’s official status page when several unrelated calls fail. The SDK guide provides retry and timeout configuration; use those controls deliberately and avoid retrying indefinitely after a task’s deadline. Official Perplexity documentation.
When the network drops after dispatch, treat downstream side effects carefully. Preserve the task identifier and determine whether your application already accepted or published a result before repeating work. A retry that creates a duplicate report or notification can be an application bug even if both provider calls are valid.
Use the current Python tutorial to restore a small baseline, then reintroduce the feature that reproduces the failure. Return to the Perplexity API overview for product context. Document the safe cause and fix so the next operator does not need to rediscover whether the issue concerned access, product mapping or output validation.
Frequently asked questions
Why is choices missing from my response?
Should I log the complete error response?
Does a permission error always mean the key is invalid?
Should I retry a malformed request?
Can the API succeed while the task fails?
What should I check after a Sonar-to-Agent migration?
Sources
- SDK error categories ↗
- Client retry and timeout configuration ↗
- Keys and project access ↗
- Product limits ↗
- Migration contract ↗
- Search filters ↗
Last verified · Source ↗