Skip to main content
This guide covers common API-related errors that may arise when working with the Definable backend.

HTTP Status Code Errors

Symptoms:
  • Error response with status code 400
  • Response body containing validation errors
  • Client-side error messages about invalid data
Solutions:
  1. Check request payload format:
  2. Validate against API schema:
    • Review the API documentation for required fields
    • Check field types and constraints
    • Use Pydantic validators for client-side validation
  3. Check for missing required fields:
    • Ensure all required fields are included
    • Pay attention to nested objects and arrays
    • Check for typos in field names
Symptoms:
  • Error response with status code 401
  • Message indicating β€œUnauthorized” or β€œInvalid credentials”
  • JWT-related errors
Solutions:
  1. Verify authentication headers:
  2. Check token expiration:
  3. Refresh the token if expired:
  4. Check user permissions in your database:
    • Verify user exists and is active
    • Check if account is locked or disabled
Symptoms:
  • Error response with status code 403
  • Message indicating β€œForbidden” or β€œInsufficient permissions”
  • RBAC-related errors
Solutions:
  1. Check user roles and permissions:
  2. Verify endpoint permission requirements:
    • Review API documentation for required permissions
    • Ensure the authenticated user has the necessary role
  3. Check organization/workspace access:
    • Some endpoints require specific organization membership
    • Verify the user belongs to the correct organization
  4. Review role-based access control settings:
    • Update user roles if necessary
    • Check if permissions have changed in recent deployments
Symptoms:
  • Error response with status code 404
  • Message indicating β€œNot Found” or β€œResource not found”
Solutions:
  1. Verify the API endpoint URL:
  2. Check if the resource exists:
  3. Examine resource permissions:
    • Resource may exist but not be accessible to current user
    • Check if resource belongs to a different organization
  4. Check API version:
    • Ensure you’re using the correct API version
    • Some endpoints may be deprecated or moved
Symptoms:
  • Error response with status code 429
  • Message about rate limits or quotas
  • Headers indicating rate limit information
  • Response body containing β€œdetail”: β€œToo many requests”
Solutions:
  1. Implement exponential backoff:
  2. Check for rate limit headers:
  3. Optimize API usage:
    • Batch requests when possible
    • Cache responses to reduce API calls
    • Implement request throttling on client side
  4. Understand Definable’s rate limiting implementation:
Symptoms:
  • Error response with status code 500
  • Generic error messages in response
  • Server-side exceptions
  • Development mode: Detailed error with traceback information
  • Production mode: Simple β€œInternal server error” message
Solutions:
  1. Check server logs for details:
    • Review application logs for exceptions
    • Look for stack traces related to your request
    • In development mode, examine the detailed error response
  2. Report the issue with details:
  3. Implement client-side error handling:
  4. Check for recent deployments or changes:
    • Recent code changes may have introduced bugs
    • Infrastructure changes might affect API stability
  5. Error structure in development mode:

Request/Response Issues

Symptoms:
  • Error messages about invalid JSON
  • Type errors when processing responses
  • Fields missing or incorrectly formatted
Solutions:
  1. Validate request data before sending:
  2. Parse response data carefully:
  3. Check for encoding issues:
  4. Handle nullable fields:
    • Use None for missing values
    • Implement default values for optional fields
Symptoms:
  • Browser console errors about CORS policy
  • Requests fail in browser but work in Postman
  • Preflight requests failing
  • β€œAccess-Control-Allow-Origin” missing or incorrect
Solutions:
  1. Check the Origin header:
  2. Verify Definable’s CORS configuration:
    • Definable’s API allows all origins by default with ”*”
    • Credentials are allowed by default
    • All methods and headers are allowed
  3. For development, use a proxy:
  4. Handle preflight requests:
    • Complex requests trigger OPTIONS preflight
    • Ensure server correctly responds to OPTIONS
    • Check allowed headers and methods in response
  5. Debug CORS issues:
Symptoms:
  • β€œUnsupported Media Type” errors
  • Character encoding problems in responses
  • Binary data corruption
Solutions:
  1. Set the correct Content-Type header:
  2. Handle different response types:
  3. For file uploads, use multipart/form-data:
  4. Handle character encodings:

Authentication Issues

Symptoms:
  • β€œToken expired” or β€œInvalid token” errors
  • β€œInvalid authorization” error message
  • Frequent authentication failures
  • Error message: β€œInvalid or expired token”
  • Status code 403 with JWT-related error messages
Solutions:
  1. Implement proper token storage and refresh:
  2. Check token payload and claims:
  3. Implement token validation on client:
  4. Handle clock skew issues:
    • Server and client time differences can cause premature expiration
    • Add a buffer time when checking expiration
    • Consider using NTP to synchronize system clocks
  5. Understand Definable’s JWT implementation:
Symptoms:
  • OAuth flow redirects failing
  • β€œInvalid client” or β€œInvalid redirect URI” errors
  • Access token exchange failures
Solutions:
  1. Verify OAuth configuration:
    • Double-check client ID and client secret
    • Ensure redirect URI exactly matches the registered one
    • Check scope parameters match required permissions
  2. Debug OAuth flow:
  3. Implement proper state validation:
  4. Debug token exchange:

Integration Issues

Symptoms:
  • β€œNo route matched with those values” errors
  • Unexpected 404 errors on valid endpoints
  • Routing inconsistencies between environments
Solutions:
  1. Check API gateway configuration:
    • Verify routes and service mappings
    • Check for path prefix issues
  2. Trace request path:
  3. Test endpoints directly vs. through gateway:
    • Try accessing the service directly if possible
    • Compare behavior through API gateway vs. direct
  4. Check for trailing slash issues:
    • Some routing configurations treat paths with/without trailing slashes differently
    • Try both variations to identify the issue
Symptoms:
  • Timeouts between services
  • Incomplete data in responses
  • Cascading failures
Solutions:
  1. Implement circuit breakers:
  2. Add proper timeouts:
  3. Implement retry with backoff:
  4. Monitor inter-service communication:
    • Implement distributed tracing (Jaeger, Zipkin)
    • Add correlation IDs to track requests across services

Performance Issues

Symptoms:
  • Requests failing with timeout errors
  • Long response times
  • Client disconnections
Solutions:
  1. Configure appropriate timeouts:
  2. Break down large requests:
    • Split large operations into smaller batches
    • Implement pagination for large data sets
  3. Consider asynchronous processing:
    • For long-running operations, use a job-based approach
  4. Use server-sent events or WebSockets for long operations:
    • Maintain a single connection for updates
    • Avoid repeated polling
Symptoms:
  • 429 Too Many Requests errors
  • Inconsistent API availability
  • Batch operations partially succeeding
Solutions:
  1. Implement client-side rate limiting:
  2. Implement exponential backoff with jitter:
  3. Batch requests appropriately:
    • Group related operations to reduce API calls
    • Use bulk endpoints when available
  4. Monitor API usage and limits:
    • Track rate limit headers in responses
    • Schedule critical operations during low-usage periods

Next Steps

If you’ve resolved your API issues, consider reviewing these related guides: If you’re still experiencing API problems, check the API documentation or contact the development team for assistance.