Troubleshooting

In the event that something goes wrong while using the Kinvey SDK, there are some steps you can take to figure out what the issue might be. The Kinvey SDK will throw an exception when an error occurs, and Kinvey-related exceptions are of type KinveyException.

KinveyException

Exceptions thrown by the Kinvey SDK are of the type KinveyException, and they encompass errors that occur both on the client-side as well as server-side errors. When inspecting a KinveyException, there are 5 fields of interest:

  • ErrorCategory
  • ErrorCode
  • Error
  • Description
  • Debug

ErrorCategory

The ErrorCategory property is an enumeration which categorizes the high-level grouping of the error. Categories include error areas like ERROR_CLIENT, ERROR_REQUIREMENT and ERROR_DATASTORE_CACHE, and can be useful in understanding the general area in which the error occurred.

ErrorCode

The ErrorCode property provides an enumeration of the specific error that occurred, which when coupled with the ErrorCategory property will reveal exactly what caused the exception. Examples of this include: ERROR_CLIENT_SHARED_CLIENT_NULL, ERROR_REQUIREMENT_HTTPS and ERROR_DATASTORE_CACHE_REFRESH to name a few.

A full list of all ErrorCategory and ErrorCode values can be found in the API Reference.

Error

The Error property of the KinveyException provides a sentence description of what the error is. It is essentially a description of what the ErrorCategory and ErrorCode encapsulate.

Description

This property provides more information regarding the error that occurred, and should be used along with the Error to determine what the cause of the issue is.

Debug

The Debug property may provide some insight as to what may have caused this error, and can be used to help in debugging efforts.

Error Reporting

All Kinvey REST APIs return error responses using standard HTTP error codes. The error reporting is designed to make the APIs more usable—easy to implement and debug. Starting with API version 1, error responses are consistent across all REST API endpoints and use a structured format.

Every error response uses a universal dictionary to describe the error. The dictionary may see some updates from time to time but any updates are only expected to add new types of errors. Individual REST API methods will describe any behavior that diverges from the dictionary.

ErrorStatusCodeDescription
ParameterValueOutOfRange400The value specified for one of the request parameters is out of range
InvalidQuerySyntax400The query string in the request has an invalid syntax
MissingQuery400The request is missing a query string
JSONParseError400Unable to parse the JSON in the request
MissingRequestHeader400The request is missing a required header
IncompleteRequestBody400The request body is either missing or incomplete
MissingRequestParameter400A required parameter is missing from the request
InvalidIdentifier400One of more identifier names in the request has an invalid format
FeatureUnavailable400Requested functionality is unavailable in this API version
CORSDisabled400Cross Origin Support is disabled for this application
APIVersionNotAvailable400This API version is not available for your app. Please retry your request with a supported API version
BadRequest400Unable to understand request
BLRuntimeError400The Business Logic script has a runtime error. See debug message for details
InvalidCredentials401Invalid credentials. Please retry your request with correct credentials
InsufficientCredentials401The credentials used to authenticate this request are not authorized to run this operation. Please retry your request with appropriate credentials
WritesToCollectionDisallowed403This collection is configured to disallow any modifications to an existing entity or creation of new entities
IndirectCollectionAccessDisallowed403Please use the appropriate API to access this collection for this app backend
AppProblem403There is a problem with this app backend that prevents execution of this operation. Please contact support@kinvey.com for assistance
EntityNotFound404This entity not found in the collection
CollectionNotFound404This collection not found for this app backend
AppNotFound404This app backend not found
UserNotFound404This user does not exist for this app backend
BlobNotFound404This blob not found for this app backend
UserAlreadyExists409This username is already taken. Please retry your request with a different username
StaleRequest409The time window for this request has expired
KinveyInternalErrorRetry500The Kinvey server encountered an unexpected error. Please retry your request
KinveyInternalErrorStop500The Kinvey server encountered an unexpected error. Please contact support@kinvey.com for assistance
DuplicateEndUsers500More than one user registered with this username for this application. Please contact support@kinvey.com for assistance
APIVersionNotImplemented501This API version is not implemented. Please retry your request with a supported API version
APIVersionNotAvailable501This API version is not available for your app. Please retry your request with a supported API version
BLSyntaxError550The Business Logic script has a syntax error(s). See debug message for details
BLTimeoutError 550The Business Logic script did not complete in time. See debug message for details
BLViolationError550The Business Logic script violated a constraint. See debug message for details
BLInternalError550The Business Logic script did not complete. See debug message for details

The body of the response contains information on the error. The body is JSON formatted like regular responses. Errors are guaranteed to remain unchanged when using a specific API version. Each error response body contains an HTTP response Status Code and up to three attributes: two mandatory and one optional, as described below.

  • The error attribute is always present. It contains a String value representing the error type.
  • The StatusCode is the HTTP response code associated with the error.
  • The description attribute is always present. It contains a short user-friendly description of the error. You can pass the description up to the application user if you desire. Kinvey deserves the right to change the exact text of a description depending on developer feedback.
  • The debug attribute is optional and exists solely to help debug the error. An app may choose to log this debug message if the application is running in debug mode. The Kinvey backend may or may not populate this attribute depending on the exact scenario encountered. The goal with this attribute is to provide useful information that will make it very easy to isolate the root cause and implement a fix.

Please post on our support forums if you have trouble figuring out the cause or solution to an issue, and we can point you in the right direction.