> ## Documentation Index
> Fetch the complete documentation index at: https://docs.probalytics.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> Common issues and solutions

Quick fixes for frequent problems with Probalytics.

## Authentication Issues

### "Invalid API credentials" (401)

**Cause:** Incorrect authorization header format.

**Fix:** Ensure the format is `Bearer API_KEY_ID:API_KEY_SECRET`:

```bash theme={null}
# Wrong
curl -H "Authorization: api_xxx:sk_xxx" ...
curl -H "Authorization: Bearer api_xxx" ...

# Correct
curl -H "Authorization: Bearer api_xxx:sk_xxx" ...
```

### "Access denied" (403)

**Cause:** Your plan doesn't have access to the requested data.

**Common scenarios:**

* No active or trialing subscription for the REST API
* Querying `orderbook_snapshots` through ClickHouse without an Orderbook or Custom tier

**Fix:** Verify the subscription and access method in the dashboard.

***

## SQL / ClickHouse Issues

### "Authentication failed"

**Cause:** Wrong username/password or connection settings.

**Checklist:**

* Host: `clickhouse.probalytics.io`
* Port: `9440` (Secure TCP) or `8443` (Secure HTTPS)
* Database: `probalytics`
* Username and password from dashboard (not API keys)
* TLS/SSL enabled (use `--secure` flag for CLI)

### Query Times Out

**Cause:** Query is too broad or inefficient.

**Fix:** Add filters on ORDER BY columns:

```sql theme={null}
-- Slow: No filters
SELECT * FROM fills WHERE price > 0.9;

-- Fast: Filter by ORDER BY columns first
SELECT * FROM fills
WHERE platform = 'POLYMARKET'
  AND market_id = 'your-market-uuid-here'
  AND timestamp >= now() - INTERVAL 7 DAY
  AND price > 0.9;
```

See [SQL Tips](https://docs.probalytics.io/docs/sql-guide/tips.md) for optimization guidance.

### Truncated results

ClickHouse credentials can have a maximum result size. If a large query returns fewer rows than expected, aggregate in ClickHouse or split the read into smaller time ranges. Contact [support@probalytics.io](mailto:support@probalytics.io) to confirm the effective limits for your credential.

Do not assume that a successful response contains every matching row.

### "Memory limit exceeded"

**Cause:** Query uses too much memory.

**Fixes:**

* Add stricter filters to reduce data scanned
* Aggregate into a coarser time interval before returning rows:
  ```sql theme={null}
  SELECT toStartOfHour(timestamp), avg(price)
  FROM fills
  WHERE timestamp >= now() - INTERVAL 7 DAY
  GROUP BY 1
  ```
* Break query into smaller date ranges
* Upgrade tier for higher memory limits

### Duplicate Rows in Results

**Cause:** `ReplacingMergeTree` hasn't merged yet.

**Fix:** Add `FINAL` for exact results (slower):

```sql theme={null}
SELECT count() FROM markets FINAL;
```

Skip `FINAL` only when temporary duplicate identity keys are acceptable. Use it when exact deduplication is required, especially for audits and point-in-time results.

***

## REST API Issues

### Request Rejected Under Heavy Traffic

No fixed REST request quota is currently part of the public contract. Operational protections can still reject abusive or unusually concurrent traffic.

**Fix:**

* Reduce request frequency and batch where possible
* Cache responses where possible
* Retry transient 5xx responses with bounded exponential backoff

> [!NOTE]
>
> REST and direct ClickHouse connections use separate traffic and resource limits. If ClickHouse throttles or stops a query, check the limits for that credential or contact [support@probalytics.io](mailto:support@probalytics.io).

### Empty Results

**Cause:** Filters too restrictive or wrong format.

**Checklist:**

* Dates must be RFC3339: `2024-01-01T00:00:00Z`
* Enum values are uppercase: `POLYMARKET`, `ACTIVE`, `BUY`
* UUIDs must be valid format

### Slow Response Times

**Cause:** Requesting too much data at once.

**Fixes:**

* Use cursor-based pagination with `limit` and `cursor` parameters
* Add filters: `platform`, `start_time`, `end_time`, `market_id`
* Request only active/recent data

***

## Data Issues

### Missing Recent Data

**Cause:** Source-specific ingestion delay, source recovery, or an account time-window restriction.

**Note:** Most market/fill pollers normally run on short intervals, but this is not a five-minute SLA. Recovery and upstream rate limiting can extend delays. Compare `indexed_at` with the source `timestamp` where both fields are available; the difference also includes source-clock differences and processing time.

### Price Shows 0 or Unexpected Values

**Cause:** Units depend on the product, and some older/source fields may be incomplete. Perpetual prices are instrument prices and can be greater than 1. A fee of `0` can mean the fee was unavailable.

**Fix:** Join fills to markets and interpret values using `market_type`:

```sql theme={null}
SELECT f.*, m.market_type
FROM fills f
JOIN (
    SELECT id, market_type
    FROM markets
    WHERE id = 'your-market-uuid-here'  -- filter markets before joining
) m ON f.market_id = m.id
WHERE f.market_id = 'your-market-uuid-here'
```

### Market Not Found

**Cause:** Market may be:

* Too new (not indexed yet)
* From an unsupported platform
* Using wrong ID format

**Tip:** Use `platform_id` for platform-native IDs, `id` for Probalytics UUIDs.

***

## Connection Issues

### Can't Connect to ClickHouse

**Checklist:**

1. Firewall allows outbound port 9440 (Secure TCP) or 8443 (Secure HTTPS)
2. Using correct host: `clickhouse.probalytics.io`
3. Credentials are for ClickHouse (not API keys)
4. TLS/SSL is enabled in your client (use `--secure` flag for CLI)
5. Try HTTPS port (8443) if TCP (9440) is blocked

### SSL/TLS Errors

**Fix:** All connections require TLS. Ensure your client is configured for secure connections:

```bash theme={null}
# CLI - use --secure flag
clickhouse client --host=clickhouse.probalytics.io --secure --port=9440 --user=YOUR_USERNAME --password=YOUR_PASSWORD --database=probalytics
```

```python theme={null}
# clickhouse-driver - use secure=True and port 9440
client = Client(host='clickhouse.probalytics.io', port=9440, secure=True, ...)

# clickhouse-connect - use port 8443 (HTTPS)
client = clickhouse_connect.get_client(host='clickhouse.probalytics.io', port=8443, ...)
```

***

## Still Stuck?

If none of these solutions work:

1. Check [Discord](https://discord.gg/probalytics) for similar issues
2. Contact [support](https://docs.probalytics.io/docs/support.md) with:
   * Error message (full text)
   * Query or code
   * Timestamp
   * Your tier


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.