500 InternalServerError: No valid route found for X to Y on line: Z


#1

Hi everyone. I recently started using the TFL API for a side project, and ran into some issues when trying to fetch line timetable information. In particular, for a lot of requests, the API returns a 500 InternalServerError with the following message:

{"$type":"Tfl.Api.Presentation.Entities.ApiError, Tfl.Api.Presentation.Entities","timestampUtc":"2019-01-20T10:15:56.8703209Z","exceptionType":"ApiException","httpStatusCode":500,"httpStatus":"InternalServerError","relativeUri":"/Line/london-overground/Timetable/910GBARKING/to/910GGOSPLOK","message":"No valid route found for 910GBARKING to 910GGOSPLOK on line: london-overground"}

What is strange about this is that this should be a valid request, as indicated by the response to https://api.tfl.gov.uk/Line/london-overground/Route/Sequence/inbound, which under “orderedLineRoutes” has an entry with naptanIds starting from 910GBARKING and ending with 910GGOSPLOK.

Does anyone know why the Timetable request is returning this error? Am I doing something wrong, or is it a bug in the API? Thanks in advance!


#2

I think this is an internal issue. Using TFl’s Journey Planner you get routed H&C to West Ham, Jubilee to Stratford and then Overground to Gospel Oak. I agree that it’s strange that it appears in /Line/Route/Sequence. Mind you it’s one of 16 inbound branches, 8 of which are numbered 0 (including this one).

The API has a lot of problems with multiple branches, particularly anything that contains a loop or a split and rejoin. In particular this makes a mess of all the rail mode lines, as well as the Overground and some others (try to get to Heathrow Terminal 4 on the Piccadilly line, for instance)

Mind you, don’t hold your breath waiting for a fix - I raised this initially in May 2017 (see thread Missing/duplicated branches in /Line/Route/Sequence) and so far no joy.


#3

Thanks for the response Nick. It’s interesting that the inbound branches are all numbered 0, that’s not good!

Just wanted to note that although on a Sunday there are no direct Overground trains from Barking on Gospel Oak, if you set the day to Monday the TFL Journey Planner shows a direct Overground route that takes 35 minutes. So it seems like the /Line/Route/Sequence response might be correct.


#4

From memory, there is a bit of an issue about how train information (from National Rail’s Darwin system) feeds into the TfL data when a rail replacement bus service runs.

I think it’s possible that the RRBS isn’t being picked up as “london-overground” because it’s a bus service that doesn’t actually call at the normal stations on the Gospel Oak to Barking Line.