API Docs

Error Codes

This page contains a list of all the error codes that you may encounter when using the Blue API.

Blue's GraphQL API is built on Apollo Server, which provides a standardized approach to error handling. When errors occur during the processing of a GraphQL operation, Apollo Server returns a response containing an array of errors. Each error object in this array includes an 'extensions' field, which offers valuable details such as:

  1. An error code: This helps in identifying the specific type of error that occurred.
  2. A stacktrace: This is available in development mode and aids in debugging by showing the sequence of function calls that led to the error.

These error codes and additional information allow developers to efficiently diagnose and address issues in their GraphQL queries or mutations.

This is an example of what an error object looks like:

{
  "errors": [
    {
      "message": "Cannot query field \"__typenam\" on type \"Query\".",
      "locations": [
        {
          "line": 1,
          "column": 2
        }
      ],
      "extensions": {
        "code": "GRAPHQL_VALIDATION_FAILED",
        "stacktrace": [
          "GraphQLError: Cannot query field \"__typenam\" on type \"Query\".",
          "    at Object.Field (/my_project/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js:48:31)",
          "    ...additional lines..."
        ]
      }
    }
  ]
}

List of Error Codes

This is a non-exhaustive list of error codes that you may encounter.

Error CodeDescription
GRAPHQL_PARSE_FAILEDThe GraphQL operation string contains a syntax error.
GRAPHQL_VALIDATION_FAILEDThe GraphQL operation is not valid against the server's schema.
BAD_USER_INPUTThe GraphQL operation includes an invalid value for a field argument.
PERSISTED_QUERY_NOT_FOUNDA client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache.
PERSISTED_QUERY_NOT_SUPPORTEDA client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ.
OPERATION_RESOLUTION_FAILUREThe request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e., operationName), or if the named operation isn't included in the request.
BAD_REQUESTAn error occurred before your server could attempt to parse the given GraphQL operation.
INTERNAL_SERVER_ERRORAn unspecified error occurred. When Apollo Server formats an error in a response, it sets the code extension to this value if no other code is set.