Common OCR error codes

Updated at:

When an API request fails, the server returns an error message. This topic describes the error codes returned by the OCR API.

Note

For questions about API access, interface usage, or other issues with the AI capabilities of the Alibaba Cloud Visual Intelligence API, contact us through DingTalk group 23109592.

Troubleshooting center

You can use the Troubleshooting Center to diagnose problems with API calls more efficiently.

OCR error codes

Status code

Error code

Description

403

AuthFailed

Authorization failed. Check your RAM permission configuration.

400

ClientError.IllegalArgument

Check the parameters. For example, check whether the database represented by the parameter value exists.

400

EntityNotExist.Role

You do not have RAM permissions. Contact your Alibaba Cloud account owner to grant you the AliyunVIAPIFullAccess permission. For more information, see Control access permissions using RAM policies.

400

IllegalUrlParameter

The URL is invalid. Check whether the URL can be opened. For image URLs that are not for OSS in the China (Shanghai) region, see Handle file URLs.

500

InternalError

An internal server error occurred. If your business is affected, contact us through the DingTalk group (23109592).

500

InternalError.Algo

An internal algorithm processing error occurred. If your business is affected, contact us through the DingTalk group (23109592).

500

InternalError.Timeout

An internal processing timeout error occurred. If your business is affected, contact us through the DingTalk group (23109592).

400

InvalidAccessKeyId.Inactive

The AccessKey ID is invalid. Check whether the AccessKey ID is disabled, or whether the AccessKey ID and AccessKey secret are correct.

404

InvalidAccessKeyId.NotFound

The AccessKey ID does not exist. Check whether the correct AccessKey is used for the call. For more information, see Create an AccessKey.

400

InvalidAccessKeySecret

The AccessKey ID or AccessKey secret is incorrect. Check whether the AccessKey ID and AccessKey secret are correct.

400

InvalidAction.NotFound

The capability was not found. Check whether the category and capability match, and whether the endpoint and capability match. For more information, see Endpoints.

Select a programming language and modify the sample code to make the API call. For more information, see SDK overview.

400

InvalidApi.ForbiddenInvoke

The call is restricted. Check whether the capability you are calling is a restricted one. For restricted capabilities, you must find the capability in the console and submit a request. You can call the capability only after the request is approved or you manually activate it.

If this is not the case, check for overdue payments in your account.

403

InvalidApi.NotPurchase

The service is not activated. Activate the service first.

400

InvalidApi.OutOfService

The product is not activated. Activate the product.

400

InvalidFile.Content

Check the file content against the algorithm documentation. Replace the file with one that meets the algorithm requirements.

400

InvalidFile.Decode

Check whether the file can be opened.

400

InvalidFile.Download

The file cannot be downloaded. Check your on-premises network and whether the link is accessible. For file URLs that are not for OSS in the China (Shanghai) region, see Handle file URLs.

400

InvalidFile.REGION

The region in the file URL is incorrect. For file URLs that are not for OSS in the China (Shanghai) region, see Handle file URLs.

400

InvalidFile.Resolution

The file resolution exceeds the limit. Check the file resolution and content. Modify the file resolution and retry.

400

InvalidFile.Type

The file type is incorrect. Check the file type and use a type supported by the algorithm, as described in the algorithm API documentation. The Alibaba Cloud Visual Intelligence API reads the file to get its true type. It does not determine the type by the file extension. Checking only the file extension is not valid. For more information about how to determine and handle file types, see Determine and handle file types.

400

InvalidFile.URL

The file cannot be downloaded. Check your on-premises network and whether the link is accessible. For file URLs that are not for OSS in the China (Shanghai) region, see Handle file URLs.

400

InvalidImage.Category

The input image does not match the current service. For example, the input image for the vehicle license service is not a vehicle license.

400

InvalidImage.Content

The input image content is invalid. This can happen for several reasons. The image may be an invalid Base64-encoded image, an empty string, or have invalid content. The image may fail to decode. The input image may not be a valid Base64 string. If so, remove extra headers such as `data:image/jpg:base64`. The length of Base64-encoded data must be a multiple of 4. If the length is insufficient, add = to the end to pad it. The string may also contain invalid characters.

400

InvalidImage.Decode

Check whether the image can be opened.

400

InvalidImage.Download

The image cannot be downloaded. Check your on-premises network, whether the link is accessible, and whether the OSS link has expired. For image URLs that are not for OSS in the China (Shanghai) region, see Handle file URLs. URLs do not support spaces or Chinese characters. If a URL contains these characters, encode them using URLEncode before passing the URL.

400

InvalidImage.Gif

Failed to open, read, or decode the GIF image. An error occurred when getting the color mapping table, or the image is empty.

404

InvalidImage.NotFoundFace

No face was found in the image. Check whether your image contains a face or if the face is too small.

400

InvalidImage.Region

The region of the image is incorrect.

400

InvalidImage.Resolution

The file resolution exceeds the limit. Check the file resolution and content. Modify the file resolution and retry.

400

InvalidImage.Timeout

The image download timed out. Check your on-premises network, whether the link is accessible, and whether the OSS link has expired. For file URLs that are not for OSS in the China (Shanghai) region, see Handle file URLs.

400

InvalidImage.Type

The image type is incorrect. Check the image type and use a type supported by the algorithm, as described in the algorithm API documentation.

400

InvalidImage.Unsafe

The URL is not secure.

415

InvalidImage.UnsupportedMediaType

The input image failed to be decoded.

400

InvalidImage.URL

The image URL is invalid. Check whether the image URL is accessible. For image URLs that are not for OSS in the China (Shanghai) region, see Handle file URLs. For OSS links in the China (Shanghai) region, use standard OSS domain names. Accelerated domain names and custom domain names are not supported.

400

InvalidImageType

Invalid image type.

400

InvalidOutputFormat

Invalid output format.

400

InvalidParameter

The parameter value failed verification. Use the request parameters to construct a standardized query string in the request. For more information, see Request signing.

400

InvalidParameter.BadRequest

A parameter is incorrect. Check the parameter value against the algorithm API documentation and the error message. Check for extra spaces or other special characters before or after the parameter value.

400

InvalidParameter.NotFound

A parameter is incorrect. Check the parameter value against the algorithm API documentation and the error message. Check for extra spaces or other special characters before or after the parameter value.

400

InvalidParameter.TooLarge

The content to be detected is too large. Make sure the content is within the API limits.

400

InvalidRamRole

You do not have RAM permissions. Contact your Alibaba Cloud account owner to grant you the AliyunVIAPIFullAccess permission. For more information, see Control access permissions using RAM policies.

400

InvalidResult

OCR detection failed or was abnormal.

400

InvalidSide

The Side parameter is invalid.

400

InvalidTimeStamp.Expired

The difference between the user's time and the server's time is more than 15 minutes. Check your timestamp settings to make sure the time difference is within 15 minutes.

400

MissingAccessKeyId

The AccessKey ID is missing. For more information, see Create an AccessKey.

400

MissingAssureDirection

The AssureDirection parameter is missing.

400

MissingImageURL

The image URL parameter is missing.

400

MissingMinHeight

The MinHeight parameter is missing.

400

MissingOutputFormat

The output format is missing.

400

MissingSide

The Side parameter is missing.

400

MissingSkipDetection

The SkipDetection parameter is missing.

400

MissingUseFinanceModel

The UseFinanceModel parameter is missing.

400

ParameterError

A parameter is incorrect. Check the parameter value.

503

ServiceUnavailable

The service is unavailable. If the server has returned a RequestId, contact us through the DingTalk group (23109592).

400

SignatureDoesNotMatch

The signature does not match. Check whether the AccessKey ID and AccessKey secret are correct. Check whether the signing method is correct. For more information about signing, see Request signing.

400

SignatureNonceUsed

The SignatureNonce is a duplicate. The SignatureNonce for each request must be unique within 15 minutes.

400

Throttling

Throttling was triggered. For paid APIs, purchase a higher QPS. For free APIs with special requirements, contact us through the DingTalk group (23109592).

Note

When throttling is triggered, both Throttling and Throttling.User errors can occur. Consider both when handling the error.

400

MissingParameter

A parameter is missing. Check the parameter value against the documentation.

400

Throttling.User

The traffic for this period has exceeded the limit. For paid APIs, purchase a higher QPS. For free APIs with special requirements, contact us through the DingTalk group (23109592).

Note

When throttling is triggered, both Throttling and Throttling.User errors can occur. Consider both when handling the error.

408

Timeout

The request timed out.

403

Unauthorized

RAM permission verification failed. For more information, see Control access permissions using RAM policies.

403

UnsupportedHTTPMethod

The HTTP request method is not supported.

Common error codes

For common API error codes, see API Error Center.

Troubleshooting suggestions

If a service request returns an error code, refer to the description of the error code to identify the cause and resolve the issue. The following suggestions can help you troubleshoot common errors.

  • URL-related error codes

    These error codes usually indicate that the file URL does not meet the requirements. For example, the URL is not secure or is invalid. For more information, see Handle file URLs.

  • Image loading error codes

    These errors are typically related to image URLs and can be caused by image download failures or incorrect region settings. You must use the China (Shanghai) region. If you generate a URL using OSS, the corresponding OSS bucket must also be in the China (Shanghai) region. For more information, see Handle file URLs.

  • Parameter-related error codes

    These error codes usually indicate that the input parameters do not meet the requirements, such as a missing parameter or an incorrect parameter type. You can check the input parameters against the request parameters table in the API documentation.

  • System service error codes

    If this type of error occurs, resend the service request. If the problem persists, provide feedback in DingTalk group 23109592.