Errors

Errors occur even in the best of systems, and we always try to provide sensible error codes to help you handle the error properly. All errors that you encounter in the All Aboard API will be GraphQL errors, optionally with an extensions property.

Extensions

Extensions are a GraphQL feature that allow us to add additional information to the error response. This is where we add the error code and any additional information which can help you identify the cause of the error.

json
{
  "errors": [
    {
      "message": "Message describing what went wrong",
      "locations": [{ "line": 6, "column": 7 }],
      "path": ["node", "field", 1, "name"],
      "extensions": {
        "code": "ERROR_CODE",
        "args": {
          "name": "value"
        }
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Message describing what went wrong",
      "locations": [{ "line": 6, "column": 7 }],
      "path": ["node", "field", 1, "name"],
      "extensions": {
        "code": "ERROR_CODE",
        "args": {
          "name": "value"
        }
      }
    }
  ]
}

Authentication and Authorization

UNAUTHORIZED

This happens when the api-key header is missing or the provided API key is invalid.

json
{
  "errors": [
    {
      "message": "Unauthorized",
      "extensions": {
        "code": "UNAUTHORIZED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Unauthorized",
      "extensions": {
        "code": "UNAUTHORIZED"
      }
    }
  ]
}

NOT_AUTHENTICATED

This happens when authentication is required but the request is not authenticated (e.g., when using JWT authentication).

json
{
  "errors": [
    {
      "message": "Not authenticated",
      "extensions": {
        "code": "NOT_AUTHENTICATED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Not authenticated",
      "extensions": {
        "code": "NOT_AUTHENTICATED"
      }
    }
  ]
}

NOT_AUTHORIZED

This happens when the authenticated user does not have permission to perform the requested action.

json
{
  "errors": [
    {
      "message": "Not authorized",
      "extensions": {
        "code": "NOT_AUTHORIZED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Not authorized",
      "extensions": {
        "code": "NOT_AUTHORIZED"
      }
    }
  ]
}

Node and Resource Lookup

NOT_FOUND

This happens when a resource that is required by an operation cannot be found.

json
{
  "errors": [
    {
      "message": "Part was not found",
      "extensions": {
        "code": "NOT_FOUND"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Part was not found",
      "extensions": {
        "code": "NOT_FOUND"
      }
    }
  ]
}

INVALID_ID

This happens when an invalid ID format is provided.

json
{
  "errors": [
    {
      "message": "Invalid order id",
      "extensions": {
        "code": "INVALID_ID"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Invalid order id",
      "extensions": {
        "code": "INVALID_ID"
      }
    }
  ]
}

Validation

VALIDATION_ERROR

When working with Bookings or other inputs, the input data is validated and may fail validation. This error code is used when the input data is invalid. The extensions.validation property will contain the validation rule that failed.

json
{
  "errors": [
    {
      "message": "Passenger date of birth is required",
      "extensions": {
        "code": "VALIDATION_ERROR",
        "validation": "REQUIRED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Passenger date of birth is required",
      "extensions": {
        "code": "VALIDATION_ERROR",
        "validation": "REQUIRED"
      }
    }
  ]
}

Common validation values include:

  • REQUIRED - A required field is missing
  • MISSING_CONTACT_PERSON - Contact person is missing
  • MISSING_CONTACT_PERSON_EMAIL - Contact person email is missing
  • MISSING_CONTACT_PERSON_TEL - Contact person telephone is missing
  • MISSING_ARGUMENTS - Required arguments are missing

Booking and Order Errors

UNKNOWN

This can happen either when creating a booking or when prebooking tickets which happens when creating an order or a payment. This error code is used when we encounter an upstream error from one of our ticketing providers and the error is not recognized or when the error is not related to the booking or prebooking.

json
{
  "errors": [
    {
      "message": "Unable to process booking",
      "extensions": {
        "code": "UNKNOWN"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Unable to process booking",
      "extensions": {
        "code": "UNKNOWN"
      }
    }
  ]
}

NO_TICKETS

Tickets may sell out between the time you select a journey and the time you create a booking. This error code is used when one or more of the selected tickets are no longer available. In that case you should request a new JourneyOffer before trying to create a booking again.

You can use the extensions.args.originName and extensions.args.destinationName to determine which tickets are no longer available.

json
{
  "errors": [
    {
      "message": "One of the selected tickets are no longer available",
      "extensions": {
        "code": "NO_TICKETS",
        "args": {
          "originName": "London",
          "destinationName": "Paris"
        }
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "One of the selected tickets are no longer available",
      "extensions": {
        "code": "NO_TICKETS",
        "args": {
          "originName": "London",
          "destinationName": "Paris"
        }
      }
    }
  ]
}

COMPARTMENT_TYPE_UNAVAILABLE

The selected compartment type is not available for the selected journey. This error code is used when the selected compartment type is not available for the selected journey. In that case you should request a new JourneyOffer before trying to create a booking again.

json
{
  "errors": [
    {
      "message": "The selected compartment type is not available",
      "extensions": {
        "code": "COMPARTMENT_TYPE_UNAVAILABLE"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The selected compartment type is not available",
      "extensions": {
        "code": "COMPARTMENT_TYPE_UNAVAILABLE"
      }
    }
  ]
}

BOOKING_ALREADY_USED

Due to technical limitations with certain ticketing providers, some bookings (depending on the underlying operator) can only be used once. This means that if you try to create an order or a payment which then fails, the booking cannot be reused to perform the same action again. In that case you should create a new booking and try again.

json
{
  "errors": [
    {
      "message": "This booking cannot be used again",
      "extensions": {
        "code": "BOOKING_ALREADY_USED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "This booking cannot be used again",
      "extensions": {
        "code": "BOOKING_ALREADY_USED"
      }
    }
  ]
}

PRICE_CHANGED

The price has changed since the selection was made. You should request a new JourneyOffer before trying to create a booking again.

json
{
  "errors": [
    {
      "message": "The price has changed since the selection was made",
      "extensions": {
        "code": "PRICE_CHANGED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The price has changed since the selection was made",
      "extensions": {
        "code": "PRICE_CHANGED"
      }
    }
  ]
}

SEAT_UNAVAILABLE

The desired seat is not available for booking.

json
{
  "errors": [
    {
      "message": "The desired seat is not available",
      "extensions": {
        "code": "SEAT_UNAVAILABLE"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The desired seat is not available",
      "extensions": {
        "code": "SEAT_UNAVAILABLE"
      }
    }
  ]
}

NOT_ENOUGH_FUNDS

This happens when trying to create an order but there are not enough funds in the wallet.

json
{
  "errors": [
    {
      "message": "Not enough funds in wallet",
      "extensions": {
        "code": "NOT_ENOUGH_FUNDS"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Not enough funds in wallet",
      "extensions": {
        "code": "NOT_ENOUGH_FUNDS"
      }
    }
  ]
}

ORDER_LOCKED

The order is locked by another operation and cannot be modified at this time.

json
{
  "errors": [
    {
      "message": "Order is locked by other operation.",
      "extensions": {
        "code": "ORDER_LOCKED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Order is locked by other operation.",
      "extensions": {
        "code": "ORDER_LOCKED"
      }
    }
  ]
}

Passenger Validation Errors

INVALID_AGE

The provided age doesn't match the passenger birth dates.

json
{
  "errors": [
    {
      "message": "The provided age doesn't match the passenger birth dates",
      "extensions": {
        "code": "INVALID_AGE"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The provided age doesn't match the passenger birth dates",
      "extensions": {
        "code": "INVALID_AGE"
      }
    }
  ]
}

AGE_CATEGORY_CHANGED

A passenger birth date has changed in a way that the passenger type changed from search. You can use extension.args.passengerId to identify which passenger the error pertains to.

json
{
  "errors": [
    {
      "message": "A passenger birth date has changed in a way that the passenger type changed from search",
      "extensions": {
        "code": "AGE_CATEGORY_CHANGED",
        "args": {
          "passengerId": "79011659-7a83-44e9-b656-d7d7de73ab67"
        }
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "A passenger birth date has changed in a way that the passenger type changed from search",
      "extensions": {
        "code": "AGE_CATEGORY_CHANGED",
        "args": {
          "passengerId": "a727a0d8-b3ca-4cbc-96ef-14eea734e327"
        }
      }
    }
  ]
}

PASSENGER_FIELD_MISSING

A required passenger field is missing. The extensions.args.field property will contain the name of the missing field and the extensions.args.passengerId can help you identify the passenger.

json
{
  "errors": [
    {
      "message": "Missing passenger field birthDate",
      "extensions": {
        "code": "PASSENGER_FIELD_MISSING",
        "args": {
          "field": "birthDate",
          "passengerId": "b963152c-233a-4596-8556-3df2450c39f1"
        }
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Missing passenger field birthDate",
      "extensions": {
        "code": "PASSENGER_FIELD_MISSING",
        "args": {
          "field": "birthDate",
          "passengerId": "bd1226d0-2e00-4281-8a03-446a99065278"
        }
      }
    }
  ]
}

PASSENGER_VALIDATION_FAILED

Passenger validation failed. Additional details may be provided in extensions.args.

json
{
  "errors": [
    {
      "message": "Passenger last name must be between 2 and 15 characters long",
      "extensions": {
        "code": "PASSENGER_VALIDATION_FAILED",
        "args": {
          "validation": "LENGTH",
          "field": "lastName",
          "min": 2,
          "max": 15,
          "passengerId": "1824daa3-a3b3-4150-9ed9-877f5586adb9"
        }
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Passenger last name must be between 2 and 15 characters long",
      "extensions": {
        "code": "PASSENGER_VALIDATION_FAILED",
        "args": {
          "validation": "LENGTH",
          "field": "lastName",
          "min": 2,
          "max": 15,
          "passengerId": "987d0757-2ab9-4bd3-9711-c1eec53bbaf7"
        }
      }
    }
  ]
}

UNKNOWN_PASSENGER_ERROR

An unknown error occurred while resolving passenger placeholders.

json
{
  "errors": [
    {
      "message": "Unknown passenger error",
      "extensions": {
        "code": "UNKNOWN_PASSENGER_ERROR"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Unknown passenger error",
      "extensions": {
        "code": "UNKNOWN_PASSENGER_ERROR"
      }
    }
  ]
}

Rail Pass Errors

INVALID_COUNTRY_FOR_PASS

The selected type of pass (Eurail or Interrail) is not valid in the passenger's country of residence.

json
{
  "errors": [
    {
      "message": "The selected type of pass (Eurail or Interrail) is not valid in the passenger's country of residence",
      "extensions": {
        "code": "INVALID_COUNTRY_FOR_PASS"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The selected type of pass (Eurail or Interrail) is not valid in the passenger's country of residence",
      "extensions": {
        "code": "INVALID_COUNTRY_FOR_PASS"
      }
    }
  ]
}

NO_COUNTRY_PROVIDED

No country of residence was provided for a passenger.

json
{
  "errors": [
    {
      "message": "No country of residence was provided",
      "extensions": {
        "code": "NO_COUNTRY_PROVIDED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "No country of residence was provided",
      "extensions": {
        "code": "NO_COUNTRY_PROVIDED"
      }
    }
  ]
}

CAMPAIGN_CLOSED

The selected campaign deal is no longer available.

json
{
  "errors": [
    {
      "message": "The selected campaign deal is no longer available",
      "extensions": {
        "code": "CAMPAIGN_CLOSED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The selected campaign deal is no longer available",
      "extensions": {
        "code": "CAMPAIGN_CLOSED"
      }
    }
  ]
}

CAMPAIGN_NOT_FOUND

The campaign with the given ID does not exist.

json
{
  "errors": [
    {
      "message": "The campaign with the given id does not exist",
      "extensions": {
        "code": "CAMPAIGN_NOT_FOUND"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The campaign with the given id does not exist",
      "extensions": {
        "code": "CAMPAIGN_NOT_FOUND"
      }
    }
  ]
}

DATE_OF_BIRTH_AND_PASS_TYPE_INCOMPATIBLE

The selected pass type is not compatible with the given birth date.

json
{
  "errors": [
    {
      "message": "The selected pass type is not compatible with the given birth date",
      "extensions": {
        "code": "DATE_OF_BIRTH_AND_PASS_TYPE_INCOMPATIBLE"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The selected pass type is not compatible with the given birth date",
      "extensions": {
        "code": "DATE_OF_BIRTH_AND_PASS_TYPE_INCOMPATIBLE"
      }
    }
  ]
}

Timetable Errors

OUTSIDE_TIMETABLE

Just like with ticket availability, operators release new timetables at different intervals. Most often this happens around the end of the year when both booking horizons and timetable availability may be shorter than usual.

json
{
  "errors": [
    {
      "message": "The timetable for the given date is not available yet",
      "extensions": {
        "code": "OUTSIDE_TIMETABLE"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "The timetable for the given date is not available yet",
      "extensions": {
        "code": "OUTSIDE_TIMETABLE"
      }
    }
  ]
}

DATE_IN_PAST

The search date is in the past.

json
{
  "errors": [
    {
      "message": "Search date is in the past",
      "extensions": {
        "code": "DATE_IN_PAST"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Search date is in the past",
      "extensions": {
        "code": "DATE_IN_PAST"
      }
    }
  ]
}

LOCATIONS_EQUAL

Equal origin and destination locations were provided.

json
{
  "errors": [
    {
      "message": "Equal origin and destination given",
      "extensions": {
        "code": "LOCATIONS_EQUAL"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Equal origin and destination given",
      "extensions": {
        "code": "LOCATIONS_EQUAL"
      }
    }
  ]
}

LOCATION_NOT_FOUND

A location with the given UID could not be resolved.

json
{
  "errors": [
    {
      "message": "Could not resolve location e:...",
      "extensions": {
        "code": "LOCATION_NOT_FOUND"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Could not resolve location e:...",
      "extensions": {
        "code": "LOCATION_NOT_FOUND"
      }
    }
  ]
}

RATE_LIMITED

The request has been rate limited. See the rateLimits field of SalesAgent for details.

json
{
  "errors": [
    {
      "message": "You have been rate limited.",
      "extensions": {
        "code": "RATE_LIMITED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "You have been rate limited.",
      "extensions": {
        "code": "RATE_LIMITED"
      }
    }
  ]
}

Refund Errors

ALREADY_REFUNDED

The order is already refunded.

json
{
  "errors": [
    {
      "message": "Order is already refunded.",
      "extensions": {
        "code": "ALREADY_REFUNDED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Order is already refunded.",
      "extensions": {
        "code": "ALREADY_REFUNDED"
      }
    }
  ]
}

REFUND_ALREADY_IN_PROGRESS

A refund is already in progress for this order.

json
{
  "errors": [
    {
      "message": "A refund is already in progress.",
      "extensions": {
        "code": "REFUND_ALREADY_IN_PROGRESS"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "A refund is already in progress.",
      "extensions": {
        "code": "REFUND_ALREADY_IN_PROGRESS"
      }
    }
  ]
}

REFUND_EXPIRED

The refund has expired.

json
{
  "errors": [
    {
      "message": "Refund has expired.",
      "extensions": {
        "code": "REFUND_EXPIRED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Refund has expired.",
      "extensions": {
        "code": "REFUND_EXPIRED"
      }
    }
  ]
}

REFUND_INVALID

The refund is invalid.

json
{
  "errors": [
    {
      "message": "Refund is invalid.",
      "extensions": {
        "code": "REFUND_INVALID"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Refund is invalid.",
      "extensions": {
        "code": "REFUND_INVALID"
      }
    }
  ]
}

Other Errors

NO_MATCH

Unable to find a matching trip.

json
{
  "errors": [
    {
      "message": "Unable to find a matching trip",
      "extensions": {
        "code": "NO_MATCH"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Unable to find a matching trip",
      "extensions": {
        "code": "NO_MATCH"
      }
    }
  ]
}

VALIDATION_FAILED

Order validation failed. This is a general validation error that may occur during order creation.

json
{
  "errors": [
    {
      "message": "Order validation failed",
      "extensions": {
        "code": "VALIDATION_FAILED"
      }
    }
  ]
}
{
  "errors": [
    {
      "message": "Order validation failed",
      "extensions": {
        "code": "VALIDATION_FAILED"
      }
    }
  ]
}