Skip to content

Error Codes

Error codes appear in the code field of allfeat:failed and allfeat:error event payloads.

CodeHTTP StatusDescriptionRecommended Action
TOKEN_EXPIRED401JWT token has expiredRefresh the token via setToken() — handled automatically if you listen to allfeat:token-expired
INVALID_SITE_KEY401The site-key attribute is missing, invalid, or doesn’t match the token’s organizationVerify the site-key attribute matches your organization’s public key from the Allfeat Dashboard
FORBIDDEN403Token doesn’t have permission for this actionVerify action_type, allowed_network, and allowed_ats_id match the widget’s configuration
NOT_FOUND404Resource not foundVerify the access code is correct and the work exists on the specified network
CONFLICT409Duplicate or conflicting operationThe work may already be registered or a concurrent operation is in progress
RATE_LIMITED429Too many requestsWait and retry. The widget handles this internally with exponential backoff
BAD_REQUEST400Invalid request dataCheck form data and attributes. Covers 400, 413 (file too large), and 422 (validation)
SERVER_ERROR5xxAllfeat API server errorRetry later. If persistent, contact Allfeat support
CodeDescriptionRecommended Action
NETWORK_ERRORNetwork connectivity issueCheck the user’s internet connection. The widget will show an error screen
UPLOAD_ERRORFile upload to S3 failedThe widget retries up to 3 times automatically. If still failing, check file size and network
UNKNOWN_ERRORUnexpected errorLog the full event detail and report to Allfeat support if recurring
const widget = document.querySelector('ats-widget');
// Log all errors (fatal + non-fatal)
['allfeat:failed', 'allfeat:error'].forEach(eventName => {
widget.addEventListener(eventName, (e) => {
console.error(`[ATS ${eventName}]`, e.detail);
// Send to your monitoring service
analytics.track('ats_error', {
event: eventName,
code: e.detail.code,
stage: e.detail.stage,
error: e.detail.error,
});
});
});
widget.addEventListener('allfeat:failed', (e) => {
switch (e.detail.code) {
case 'TOKEN_EXPIRED':
// Handled by allfeat:token-expired listener
break;
case 'INVALID_SITE_KEY':
showMessage('Configuration error. Please contact support.');
break;
case 'FORBIDDEN':
showMessage('You do not have permission to perform this action.');
break;
case 'RATE_LIMITED':
showMessage('Too many requests. Please wait a moment.');
break;
case 'NETWORK_ERROR':
showMessage('Connection lost. Please check your internet.');
break;
default:
showMessage('An unexpected error occurred. Please try again.');
widget.reset();
}
});

When using the widget’s API client directly (advanced usage), errors are thrown as AtsApiException:

import { AtsApiException, ApiErrorCode } from 'allfeat-ats-component';
try {
await someApiCall();
} catch (err) {
if (err instanceof AtsApiException) {
console.log(err.code); // ApiErrorCode enum value
console.log(err.httpStatus); // 401, 403, etc.
console.log(err.isRetryable()); // true for NETWORK_ERROR, SERVER_ERROR, RATE_LIMITED
console.log(err.isTokenExpired()); // true for TOKEN_EXPIRED
}
}