perplexity-common-errors
Diagnose and fix Perplexity Sonar API errors and exceptions. Use when encountering Perplexity errors, debugging failed requests, or troubleshooting integration issues. Trigger with phrases like "perplexity error", "fix perplexity", "perplexity not working", "debug perplexity", "perplexity 429".
What this skill does
# Perplexity Common Errors
## Overview
Quick reference for the most common Perplexity Sonar API errors, their root causes, and fixes. All Perplexity errors follow the OpenAI error format since the API is OpenAI-compatible.
## Prerequisites
- `PERPLEXITY_API_KEY` environment variable set
- `curl` available for diagnostic commands
## Error Reference
### 401 Unauthorized — Invalid API Key
```json
{"error": {"message": "Invalid API key", "type": "authentication_error", "code": 401}}
```
**Causes:** Key missing, expired, revoked, or doesn't start with `pplx-`.
**Fix:**
```bash
set -euo pipefail
# Verify key is set and has correct prefix
echo "${PERPLEXITY_API_KEY:0:5}" # Should print "pplx-"
# Test key directly
curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"sonar","messages":[{"role":"user","content":"test"}],"max_tokens":5}' \
https://api.perplexity.ai/chat/completions
# 200 = valid, 401 = invalid key
```
Regenerate at [perplexity.ai/settings/api](https://www.perplexity.ai/settings/api).
---
### 429 Too Many Requests — Rate Limited
```json
{"error": {"message": "Rate limit exceeded", "type": "rate_limit_error", "code": 429}}
```
**Causes:** Exceeded requests per minute (RPM). Most tiers allow 50 RPM. Perplexity uses a leaky bucket algorithm.
**Fix:**
```typescript
async function withBackoff<T>(fn: () => Promise<T>, maxRetries = 5): Promise<T> {
for (let i = 0; i <= maxRetries; i++) {
try {
return await fn();
} catch (err: any) {
if (err.status !== 429 || i === maxRetries) throw err;
const delay = Math.pow(2, i) * 1000 + Math.random() * 500;
console.log(`Rate limited. Retrying in ${delay.toFixed(0)}ms...`);
await new Promise(r => setTimeout(r, delay));
}
}
throw new Error("Unreachable");
}
```
See `perplexity-rate-limits` for queue-based solutions.
---
### 400 Bad Request — Invalid Model
```json
{"error": {"message": "Invalid model: gpt-4", "type": "invalid_request_error"}}
```
**Cause:** Using a non-Perplexity model name.
**Valid models:** `sonar`, `sonar-pro`, `sonar-reasoning-pro`, `sonar-deep-research`.
---
### 400 Bad Request — Invalid search_domain_filter
```json
{"error": {"message": "search_domain_filter must contain at most 20 domains"}}
```
**Cause:** Exceeding the 20-domain limit, or mixing allowlist (no prefix) with denylist (`-` prefix).
**Fix:** Use either allowlist OR denylist mode, not both:
```typescript
// Allowlist: only these domains
search_domain_filter: ["python.org", "docs.python.org"]
// Denylist: exclude these domains
search_domain_filter: ["-reddit.com", "-quora.com"]
```
---
### Empty Citations Array
Not an error, but a common surprise.
**Causes:** Query too abstract, non-factual question, or model couldn't find relevant sources.
**Fix:**
```typescript
// BAD: abstract query yields no citations
"Tell me about technology"
// GOOD: specific factual query
"What are the key features of TypeScript 5.5 released in 2025?"
```
Use `sonar-pro` for more citations (2x average citation count vs `sonar`).
---
### Timeout / Hanging Request
**Causes:** Complex query with `sonar-pro` or `sonar-deep-research`. Sonar: 1-3s typical. Sonar-pro: 3-8s. Deep research: 10-60s.
**Fix:**
```typescript
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 15000);
try {
const response = await perplexity.chat.completions.create(
{ model: "sonar", messages: [{ role: "user", content: query }] },
{ signal: controller.signal }
);
return response;
} finally {
clearTimeout(timeout);
}
```
---
### 402 Payment Required — No Credits
```json
{"error": {"message": "Insufficient credits", "type": "billing_error"}}
```
**Cause:** Account has no API credits remaining.
**Fix:** Add credits at [perplexity.ai/settings/api](https://www.perplexity.ai/settings/api).
## Diagnostic Commands
```bash
set -euo pipefail
# Quick API health check
curl -s -w "\nHTTP %{http_code} in %{time_total}s\n" \
-H "Authorization: Bearer $PERPLEXITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"sonar","messages":[{"role":"user","content":"ping"}],"max_tokens":5}' \
https://api.perplexity.ai/chat/completions
# Check if key env var is set
env | grep PERPLEXITY
# Test DNS resolution
dig api.perplexity.ai +short
```
## Error Handling
| HTTP Code | Error Type | Retry? | Action |
|-----------|-----------|--------|--------|
| 400 | `invalid_request_error` | No | Fix request parameters |
| 401 | `authentication_error` | No | Regenerate API key |
| 402 | `billing_error` | No | Add credits |
| 429 | `rate_limit_error` | Yes | Exponential backoff |
| 500+ | `server_error` | Yes | Retry after 2-5 seconds |
## Output
- Identified error cause from HTTP status and error type
- Applied fix or workaround
- Verified resolution with diagnostic commands
## Resources
- [Perplexity Error Handling Guide](https://docs.perplexity.ai/guides/perplexity-sdk-error-handling)
- [API Reference](https://docs.perplexity.ai/api-reference/chat-completions-post)
## Next Steps
For comprehensive debugging, see `perplexity-debug-bundle`.
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.