Error handling

Last updated: 2026-06-06
1 min read

Error 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:

  1. Wait 1 second, retry
  2. Wait 2 seconds, retry
  3. Wait 4 seconds, retry
  4. Stop after a small number of attempts

Do not retry validation errors or invalid credentials until the request is fixed.

Still need help?

Our support team is available to assist you.

Contact Support