Troubleshooting
Common issues and solutions when working with Expunct.
Authentication errors
401 Unauthorized
The API key is missing or invalid.
- Verify your API key starts with
pk_live_(production) orpk_test_(testing) - Check that the key is passed in the
X-API-Keyheader (or via the SDK constructor) - Confirm the key has not been revoked in the dashboard
# Verify your key works
curl -s -o /dev/null -w "%{http_code}" \
-H "X-API-Key: pk_live_..." \
https://api.pii-redactor.dev/api/v1/health
# Expected: 200403 Forbidden
The API key does not have permission for the requested resource. This can happen when:
- Using a test key (
pk_test_) against production resources - The key’s tenant does not own the requested policy or job
Rate limiting
429 Too Many Requests
You have exceeded the rate limit for your plan.
- The response includes a
Retry-Afterheader with the number of seconds to wait - Both SDKs automatically retry with exponential backoff (up to 3 retries)
- If you consistently hit limits, contact support to discuss plan upgrades
# The SDK handles 429 automatically, but you can configure retries:
from pii_redactor_sdk import PiiRedactor
client = PiiRedactor(
api_key="pk_live_...",
max_retries=5, # default is 3
)Not found errors
404 Not Found
The requested resource does not exist.
- Job not found: Verify the
job_idis correct. Jobs are cleaned up after the configured retention period (default: 30 days). - Policy not found: Verify the
policy_idis correct and belongs to your tenant. - Endpoint not found: Check that you are using the correct API version (
/api/v1/).
Validation errors
422 Unprocessable Entity
The request body failed validation. Common causes:
| Error | Cause | Solution |
|---|---|---|
text field is required | Empty or missing text field | Provide non-empty text |
invalid URI scheme | URI does not start with s3://, gs://, or https:// | Use a supported URI scheme |
too many URIs | Batch request exceeds 100 URIs | Split into multiple batches of 100 or fewer |
unknown entity type | Unrecognized value in entities list | Check the Entity Types page for valid values |
invalid language | Unsupported language code | Use en or es |
Connection errors
If you cannot connect to the API at all:
- Verify the base URL — The default is
https://api.pii-redactor.dev. If you are running a self-hosted deployment, confirm the URL with your infrastructure team. - Check network connectivity — Ensure your machine can reach the API endpoint. Try
curl https://api.pii-redactor.dev/api/v1/health. - Check firewall rules — The API runs on HTTPS (port 443). Ensure outbound traffic is allowed.
- Verify the service is running — For self-hosted deployments, check that all containers are healthy:
kubectl get pods -n pii-redactor.
Job status reference
When processing files or batches, jobs go through the following statuses:
| Status | Description |
|---|---|
queued | Job has been accepted and is waiting to be processed |
processing | Job is currently being processed |
completed | Job finished successfully. Output is available. |
failed | Job failed due to a processing error (e.g., corrupt file, unsupported format) |
error | Job failed due to a system error. May be retried. |
Retry patterns
Automatic retries (SDK)
Both SDKs automatically retry failed requests for transient errors:
- Retried: 5xx server errors, 429 rate limits, network timeouts
- Not retried: 4xx client errors (except 429)
- Default: Up to 3 retries with exponential backoff
- Backoff: 1s, 2s, 4s (doubling each retry)
Manual retry for failed jobs
If a job fails, you can resubmit it:
status = client.jobs.get(job_id)
if status.status in ("failed", "error"):
# Resubmit the same file
new_job = client.redact.file(file_path="/path/to/document.pdf")
print(f"Resubmitted as: {new_job.job_id}")Polling retry
When polling for job status, use reasonable intervals to avoid unnecessary load:
import time
poll_interval = 2 # seconds
max_wait = 300 # 5 minutes
elapsed = 0
while elapsed < max_wait:
status = client.jobs.get(job_id)
if status.status in ("completed", "failed", "error"):
break
time.sleep(poll_interval)
elapsed += poll_interval
else:
print("Timed out waiting for job to complete")MCP Server troubleshooting
The Expunct MCP Server connects Claude Code (and other MCP clients) to the Expunct API.
Common issues
Server fails to start
- Ensure Node.js >= 18 is installed:
node --version - Verify the
PII_REDACTOR_API_KEYenvironment variable is set - Verify the
PII_REDACTOR_BASE_URLenvironment variable is set (if using a custom deployment)
Tools not appearing in Claude Code
- Check that the MCP server is configured in your Claude Code settings (
~/.claude/settings.jsonor project-level.claude/settings.json) - Run the server manually to check for errors:
PII_REDACTOR_API_KEY=pk_live_... npx @pii-redactor/mcp
Authentication errors from MCP tools
- The MCP server uses the
PII_REDACTOR_API_KEYenvironment variable. Ensure it contains a valid key. - Test the key directly:
curl -H "X-API-Key: $PII_REDACTOR_API_KEY" \ https://api.pii-redactor.dev/api/v1/health
Getting help
If your issue is not covered here:
- Check the API Reference for detailed endpoint documentation
- Review Entity Types for supported detection categories
- Open an issue on GitHub