fashn-logo
FASHNAI
FASHN API

Errors

This guide provides an overview of error codes and how to handle errors when using the API.

If you encounter failed predictions from the /status endpoint, refer to this guide for details on runtime errors.

Common API Errors

CodeCauseSolution
400 - BadRequestThe request is invalid or improperly formatted.Check the API documentation and ensure the request follows the correct format and includes all required parameters.
401 - UnauthorizedAccessThe API key is invalid, inactive, or missing in the request.Double-check your API key and ensure it is included in the request headers under “Authorization”. (See Authentication)
404 - NotFoundThe requested resource could not be found, or the requested prediction status is no longer tracked.Double-check the URL or endpoint. If it's due to an untracked prediction ID, a corresponding message will appear.
429 - RateLimitExceededToo many requests were made in a short period.Implement request throttling and respect the API rate limits. Wait before retrying.
429 - OutOfCreditsYou’ve used up all your API credits.Check your account's API usage. Purchase more credits if needed.
500 - InternalServerErrorA server error occurred while processing the request.Retry the request after some time. If the issue persists, contact support@fashn.ai.

Runtime Errors

If an error occurs during inference (while running the model), the API will return a 200 status code with a prediction status: failed. Additionally, an error object will be included under the error key in the response.

NameCauseSolution
ImageLoadErrorThe pipeline was unable to load the model or garment image from the provided inputs.For Image URLs:
  • Ensure the URL is publicly accessible and not restricted by permissions.
  • Verify that the Content-Type header specifies the correct image format (e.g., image/jpeg, image/png).
For Base64-encoded images:
  • Prefix the string with data:image/format;base64, where format is the image type (e.g., jpeg, png).
NSFWErrorThe NSFW filter is enabled, and NSFW content was detected in either the model or garment image.If NSFW filtering is not required for your use case, disable it by setting nsfw_filter: false.
  • Note: Ensure compliance with our Terms of Use when disabling the NSFW filter.
PhotoTypeErrorThe garment_photo_type parameter is set to auto (default value), and the pipeline could not determine whether the garment image is a flat-lay or a model image.Manually set the garment_photo_type parameter to either flat-lay or model. Alternatively, improve the garment image quality according to our suggested guidelines.
PoseErrorThe pipeline was unable to detect a body pose in either the model image or the garment image (if the garment_photo_type is set to model).Improve the quality of the model or garment image by following our model photo guidelines.
PipelineErrorAn unexpected error occurred during the execution of the pipeline.Retry the request (you will not be charged for failed attempts). If the issue persists, please reach out to us at support@fashn.ai and include the request ID from the failed attempt to help us locate and address the issue promptly.

The Error Object

{
  "error": {
    "name": "PhotoTypeError",
    "message": "The error message"
  }
}

Example of an error when polling the /status endpoint:

{
  "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1",
  "status": "failed",
  "error": {
    "name": "ImageLoadError",
    "message": "Error loading model image: The URL's Content-Type is not an image. Content-Type: text/plain;charset=UTF-8"
  }
}

If you encounter an unrecognized error, please contact us at support@fashn.ai.

On this page