Error responses

June 2, 2024 ยท View on GitHub

Error responses contain an error property which is a standard RFC 7807 object with the following properties:

  • type {string}: error type
  • title {string}: short description
  • description {string}: detailed description
  • status {string}: CLIENT_ERROR or SERVER_ERROR
  • instance {string}: URL path that was called
  • additional properties might be present, depending on the error type. See below for the list of additional properties for each error type.

metadata.info includes the same information as the log parameter, providing debugging information about the request.

{
  "error": {
    "type": "NOT_FOUND",
    "title": "Some database models could not be found, e.g. the ids were invalid",
    "description": "The 'users' model with 'id' '20' could not be found",
    "status": "CLIENT_ERROR",
    "instance": "/rest/users/"
  },
  "metadata": {
    "requestid": "56ca9a87-73cc-48db-95fa-ec62e2dee812",
    "duration": 15,
    "info": {
      "timestamp": "2017-12-05T17:05:45.806Z",
      "protocol": "http",
      "ip": "127.0.0.1",
      "origin": "http://localhost:5001",
      "path": "/rest/users/",
      "method": "PUT",
      "status": "CLIENT_ERROR",
      "queryvars": {},
      "headers": {},
      "format": "json",
      "charset": "utf-8",
      "compress": "identity,identity",
      "payload": [{ "id": "20" }, { "id": "21" }],
      "payloadsize": 105,
      "payloadcount": 2,
      "rpc": "rest",
      "args": {
        "data": [
          { "id": "20", "name": "Anthony" },
          { "id": "21", "name": "David" }
        ]
      },
      "params": {},
      "datasize": 105,
      "datacount": 2,
      "summary": "users{location}",
      "commandpaths": ["", "location"],
      "commandpath": "",
      "collections": ["users", "geolocation"],
      "collection": "users",
      "command": "upsert",
      "responsedata": {},
      "responsedatasize": 170,
      "responsetype": "error"
    }
  }
}

Error types

Each error response has an associated type. Each error type has a specific title, HTTP status code, JSON-RPC error code and optionally some error-specific additional properties.

Client-side errors:

Server-side errors:

Client-side errors

VALIDATION

The request syntax or semantics is invalid.

HTTP status code: 400

JSON-RPC error code: -32602

Additional properties:

  • kind {string}: kind of validation errors. Can be:
    • feature: the collection does not support a specific feature used in the request
    • protocol: syntax error related to the protocol
    • rpc: syntax error related to the RPC system
    • argument: syntax error related to one argument
    • data: syntax error related to the data argument
    • constraint: the data argument does not validate against some constraint
  • path 'VARR'
  • value VAL
  • model OBJ
  • suggestions VAL_ARR
{
  "type": "VALIDATION",
  "title": "The request syntax or semantics is invalid",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

ABORTED

The request was aborted.

HTTP status code: 400

JSON-RPC error code: -32600

{
  "type": "ABORTED",
  "title": "The request was aborted",
  "description": "The HTTP request was aborted by the client while the server was reading its payload",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

AUTHORIZATION

The request is not authorized, i.e. not allowed to be performed.

HTTP status code: 403

JSON-RPC error code: 1

Additional properties:

  • collection {string}
  • ids {string[]}: models ids
{
  "type": "AUTHORIZATION",
  "title": "The request is not authorized, i.e. not allowed to be performed",
  "description": "The 'users' model with 'id' '10' cannot be searched",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/10",
  "collection": "users",
  "ids": ["10"]
}

ROUTE

The URL or route is invalid.

HTTP status code: 404

JSON-RPC error code: -32601

Additional properties:

  • suggestions VAL_ARR
{
  "type": "ROUTE",
  "title": "The URL or route is invalid",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

NOT_FOUND

Some database models could not be found, e.g. the ids were invalid.

HTTP status code: 404

JSON-RPC error code: 1

Additional properties:

  • collection {string}
  • ids {string[]}: models ids
{
  "type": "NOT_FOUND",
  "title": "Some database models could not be found, e.g. the ids were invalid",
  "description": "The 'users' model with 'id' '20' could not be found",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/20",
  "collection": "users",
  "ids": ["20"]
}

METHOD

The protocol method is unknown or invalid.

HTTP status code: 405

JSON-RPC error code: -32601

Additional properties:

  • suggestions STR_ARR
{
  "type": "METHOD",
  "title": "The protocol method is unknown or invalid",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

COMMAND

The command name is unknown or invalid.

HTTP status code: 405

JSON-RPC error code: -32601

Additional properties:

  • suggestions STR_ARR
{
  "type": "COMMAND",
  "title": "The command name is unknown or invalid",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

RESPONSE_NEGOTIATION

The response could not be serialized or content negotiation failed.

HTTP status code: 406

JSON-RPC error code: -32600

Additional properties:

  • kind 'compress|charset|format'
  • suggestions VAL_ARR
{
  "type": "RESPONSE_NEGOTIATION",
  "title": "The response could not be serialized or content negotiation failed",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

TIMEOUT

The request took too much time to process.

HTTP status code: 408

JSON-RPC error code: 1

Additional properties:

  • limit NUM
{
  "type": "TIMEOUT",
  "title": "The request took too much time to process",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

CONFLICT

Another client updated the same model, resulting in a conflict.

HTTP status code: 409

JSON-RPC error code: 1

Additional properties:

  • collection {string}
  • ids {string[]}: models ids
{
  "type": "CONFLICT",
  "title": "Another client updated the same model, resulting in a conflict",
  "description": "Those models already exist",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/",
  "collection": "users",
  "ids": ["9"]
}

NO_CONTENT_LENGTH

The request payload's length must be specified.

HTTP status code: 411

JSON-RPC error code: -32600

{
  "type": "NO_CONTENT_LENGTH",
  "title": "The request payload's length must be specified",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

PAYLOAD_LIMIT

The request payload is too big.

HTTP status code: 413

JSON-RPC error code: -32600

Additional properties:

  • kind 'size|models|commands|depth'
  • value NUM
  • limit NUM
{
  "type": "PAYLOAD_LIMIT",
  "title": "The request payload is too big",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

URL_LIMIT

The URL is too big.

HTTP status code: 414

JSON-RPC error code: -32600

Additional properties:

  • value NUM
  • limit NUM
{
  "type": "URL_LIMIT",
  "title": "The URL is too big",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

REQUEST_NEGOTIATION

The request payload could not be loaded, parsed or content negotiation failed.

HTTP status code: 415

JSON-RPC error code: -32700

Additional properties:

  • kind 'parse|compress|charset|format'
  • suggestions VAL_ARR
{
  "type": "REQUEST_NEGOTIATION",
  "title": "The request payload could not be loaded, parsed or content negotiation failed",
  "description": "",
  "status": "CLIENT_ERROR",
  "instance": "/rest/users/"
}

Server-side errors

CONFIG_VALIDATION

Wrong configuration caught during server startup.

HTTP status code: none. It is thrown during server startup.

JSON-RPC error code: -32603

Additional properties:

  • path {string}: path to the invalid configuration key. Example: protocols.http.port.
  • value {any}: value of the invalid configuration key. Example: -80.
  • suggestions {any[]}: suggestions of possible valid values for the configuration key. Example: [80].
{
  "type": "CONFIG_VALIDATION",
  "title": "Wrong configuration caught during server startup",
  "description": "Wrong configuration: in 'protocols.http', port must be greater than or equal to 0",
  "status": "SERVER_ERROR"
}

CONFIG_RUNTIME

Wrong configuration caught runtime.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

  • path 'VARR'
  • value VAL
  • suggestions VAL_ARR
{
  "type": "CONFIG_RUNTIME",
  "title": "Wrong configuration caught runtime",
  "description": "",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/"
}

FORMAT

Internal error related to a specific format adapter.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

{
  "type": "FORMAT",
  "title": "Internal error related to a specific format adapter",
  "description": "In the adapter 'json', could not parse content",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/",
  "adapter": "json"
}

CHARSET

Internal error related to a specific charset adapter.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

{
  "type": "CHARSET",
  "title": "Internal error related to a specific charset adapter",
  "description": "In the adapter 'utf-8', could not decode bytes",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/",
  "adapter": "utf-8"
}

PROTOCOL

Internal error related to a specific protocol adapter.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

{
  "type": "PROTOCOL",
  "title": "Internal error related to a specific protocol adapter",
  "description": "In the adapter 'http', load is not defined",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/",
  "adapter": "http"
}

RPC

Internal error related to a specific rpc adapter.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

  • adapter {string}: rpc name.
{
  "type": "RPC",
  "title": "Internal error related to a specific rpc adapter",
  "description": "In the adapter 'graphql', parse is not defined",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/",
  "adapter": "graphql"
}

DATABASE

Internal error related to a specific database adapter.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

{
  "type": "DATABASE",
  "title": "Internal error related to a specific database adapter",
  "description": "In the adapter 'memory', connection is not defined",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/",
  "adapter": "memory"
}

LOG

Internal error related to a specific log provider.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

{
  "type": "LOG",
  "title": "Internal error related to a specific log adapter",
  "description": "In the adapter 'http', could not find URL",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/",
  "adapter": "http"
}

COMPRESS

Internal error related to a specific compress adapter.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

{
  "type": "COMPRESS",
  "title": "Internal error related to a specific compress adapter",
  "description": "In the adapter 'gzip', could not read data",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/",
  "adapter": "gzip"
}

PLUGIN

Internal error related to a specific plugin.

HTTP status code: 500

JSON-RPC error code: -32603

Additional properties:

  • plugin {string}: plugin name
{
  "type": "PLUGIN",
  "title": "Internal error related to a specific plugin",
  "description": "In the plugin 'testPlugin', optA is not defined",
  "status": "SERVER_ERROR",
  "plugin": "testPlugin"
}

ENGINE

Internal engine error.

HTTP status code: 500

JSON-RPC error code: -32603

{
  "type": "ENGINE",
  "title": "Internal engine error",
  "description": "'response.metadata' should be defined",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/"
}

UNKNOWN

Internal uncaught error.

HTTP status code: 500

JSON-RPC error code: -32603

{
  "type": "UNKNOWN",
  "title": "Internal uncaught error",
  "description": "validate is not defined",
  "status": "SERVER_ERROR",
  "instance": "/rest/users/"
}