-
Notifications
You must be signed in to change notification settings - Fork 3
Errors
When running realtime-trains-py, you might run into some errors. Here is a list of errors you might encounter and how to fix them.
They're all arranged in alphabetical order, so you shouldn't have trouble finding them. You can also search for the error using Ctrl + F (on Windows and Linux) or Cmd ⌘ + F (on Mac).
realtime-trains-py error:
API response error: Failed to connect to the RTT API server: {api_response.status_code} # 400, 404, 500 etc
Response message: {api_response.text} # Will explain what the error is
This error means that there's been a problem on the API side, or realtime-trains-py tried to get non-existent data. Double check your spelling and the data you requested. If this problem persists, report an issue with realtime-trains-py on GitHub.
If the error code starts with a 4, double check the parameters you provided. If it starts with a 5, there's been a problem on the API side.
Make sure you read the documentation if you're unsure.
realtime-trains-py error:
API authentication failed. Check your credentials and try again.
Request token provided isn't valid.
This error means that you didn't pass in a valid request token when you initialised the package. Make sure you've copied the correct request token from the API portal. Make sure you read the setup guide before running your code.
If your request token is invalid, you'll have to contact Realtime Trains Support.
If this problem persists and you have correctly followed the setup guide and your request token isn't invalid, report an issue with realtime-trains-py on GitHub.
realtime-trains-py error:
Failed to write to file. Perhaps the file already exists?
File: "{file_name}"
This error means that you attempted to create a file that already exists. To overcome this, you'll have to delete the file with the same name as the one you're trying to create.
Advanced file management in on the roadmap for the future.
If this problem persists and you aren't attempting to create another file with the same name, report an issue with realtime-trains-py on GitHub.
realtime-trains-py error:
The date you provided didn't meet the requirements or fall into a valid range.
Given: "{invalid_item}"
Expected: YYYY-MM-DD format (like "2026-02-26").
This error means that the date you provided was not valid. Your date should be provided in the form YYYY-MM-DD.
Make sure you read the documentation if you're unsure.
realtime-trains-py error:
The time you provided didn't meet the requirements or fall into a valid range.
Given: "{invalid_item}"
Expected: HHMM or HH:MM format (like "1800" or "18:00").
This error means that the time you provided was not valid. Your time should be provided in the form HHMM or HH:MM.
Make sure you read the documentation if you're unsure.
realtime-trains-py error:
The TIPLOC you provided didn't meet the requirements or fall into a valid range.
Given: "{invalid_item}"
Expected: A string with length 3-7 characters (like "KNGX" or "CLPHMJN").
This error means that the TIPLOC you provided was not valid. Your TIPLOC should have between 3 and 7 characters.
Make sure you read the documentation if you're unsure.
realtime-trains-py error:
The Service UID you provided didn't meet the requirements or fall into a valid range.
Given: "{invalid_item}"
Expected: A string with 5 digits, preceded with a capital letter in most cases. (like "A12345" or "12345").
This error means that the Service UID you entered was not valid. The Service UID should be a 5- or 6-character string and should start with one letter - in most cases (not case-sensitive). A TIPLOC always has five integers. For example: G54072 or 99660. The package will return the error shown above if you provide the headcode (eg 9J35). Due to API limitations, Service UIDs must be provided instead.
Make sure you read the documentation if you're unsure.
realtime-trains-py error:
No data found for the request made. Please check your parameters and try again.
This error means that the API didn't provide any data for the parameters you used. Try checking your spelling and double check the data you provided.
Make sure you read the documentation if you're unsure.
All of our data is kindly provided by Realtime Trains.