Error handling
Last updated: 2026-06-06
•1 min readError Handling
Handle Developer API errors by checking the HTTP status and response body.
Common Status Codes
| HTTP Status | Meaning |
|---|---|
400 |
Invalid request body |
401 |
Missing or invalid API key |
404 |
Task, thread, or file not found |
429 |
Rate limit or quota exceeded |
500 |
Internal server error |
Example
const response = await fetch('https://taskforceai.chat/api/v1/developer/run', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.TASKFORCEAI_API_KEY ?? '',
},
body: JSON.stringify({ prompt: 'Review this plan' }),
});
if (!response.ok) {
const error = await response.json().catch(() => ({}));
throw new Error(error.message ?? `TaskForceAI API error: ${response.status}`);
}
const task = await response.json();
Retry Strategy
Retry transient failures with exponential backoff:
- Wait 1 second, retry
- Wait 2 seconds, retry
- Wait 4 seconds, retry
- Stop after a small number of attempts
Do not retry validation errors or invalid credentials until the request is fixed.