Skip to content
anonymous44401 edited this page Jul 15, 2026 · 11 revisions

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).

API Response Error

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.

Authentication Error

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.

File Write Error

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.

Invalid Date Provided

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.

Invalid Time Provided

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.

Invalid TIPLOC Provided

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 4-7 characters (like "KNGX" or "CLPHMJN").

This error means that the TIPLOC you provided was not valid. Your TIPLOC should have between 4 and 7 characters.

Make sure you read the documentation if you're unsure.

Invalid UID Provided

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 (starting with a capital letter in some cases) (like "A12345" or "12345").

This error means that the Service UID you entered was not valid. The Service UID should be a 6-character string and should start with one letter (not case-sensitive) followed by five integers. For example: G54072. 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.

No Data Found

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.

Clone this wiki locally