How to Fix Common GTFS Feed Errors

Understanding GTFS Error Types

When you run a GTFS feed through a validator, errors are grouped into three categories:

This guide covers the errors and warnings you are most likely to encounter, with clear explanations of what causes each one and how to fix it.


Missing File Errors

missing_required_file

What it means: Your ZIP archive is missing one of the mandatory GTFS files. The required files are: agency.txt, stops.txt, routes.txt, trips.txt, stop_times.txt, and either calendar.txt or calendar_dates.txt.

How to fix it: Check that all required files are present in the root of your ZIP (not inside a sub-folder). If a file is missing entirely, you need to create it. If it is inside a sub-folder, move it to the root level and re-zip.

unknown_file

What it means: Your ZIP contains a file that is not part of the GTFS specification (for example a .DS_Store file from a Mac, or a Thumbs.db from Windows).

How to fix it: Open your ZIP, delete any non-GTFS files, and re-zip. On a Mac, use Terminal to create the ZIP to avoid .DS_Store files being included automatically.


Missing Field Errors

missing_required_field

What it means: A mandatory column is absent from one of your files. For example, stops.txt must have stop_id, stop_name, stop_lat, and stop_lon.

How to fix it: Open the named file, check the header row (first row), and add any missing column headers. Then populate values for every row. The validator message will name both the file and the missing field.

empty_required_field

What it means: A required field exists as a column but some rows have no value. For example, a stop is missing its stop_lat or a trip is missing its route_id.

How to fix it: The validator will tell you the file, field name, and row number. Open the file, go to that row, and fill in the missing value.


Referential Integrity Errors

foreign_key_violation

What it means: A value in one file references an ID that does not exist in another file. For example, a trip in trips.txt references a route_id that is not in routes.txt, or a stop time references a trip_id that is not in trips.txt.

How to fix it: Check that every ID referenced in one file exists in the corresponding file. This is often caused by a typo in an ID (e.g., "Route_1" vs "route_1" — GTFS IDs are case-sensitive). Copy-and-paste IDs between files rather than typing them to avoid this.

duplicate_key

What it means: Two rows in the same file share the same primary key. For example, two stops with the same stop_id, or two routes with the same route_id.

How to fix it: Assign unique IDs to each record. If you accidentally copy-pasted a row, delete the duplicate. If you have two different stops that ended up with the same ID, rename one of them (and update all references to it in other files).


Timetable and Time Errors

stop_time_with_only_arrival_or_departure_time

What it means: A row in stop_times.txt has an arrival time but no departure time, or vice versa. Both fields must be either both present or both absent.

How to fix it: For every stop time row, provide both arrival_time and departure_time. If a vehicle does not wait at a stop, set both values to the same time (e.g., 09:30:00 for both).

decreasing_stop_time_distance

What it means: The shape_dist_traveled values in stop_times.txt are not strictly increasing along the trip.

How to fix it: Ensure each successive stop in a trip has a higher shape_dist_traveled value than the previous stop. This value represents cumulative distance from the start of the trip and must always increase.

service_date_range_too_far_in_future

What it means: Your service calendar extends more than a year into the future. This is flagged as a warning by most validators.

How to fix it: Set your end_date in calendar.txt to no more than 12 months from today. Plan to update your feed regularly to extend the calendar before it expires.

service_expired

What it means: Your service calendar has no future dates — all defined service periods are in the past. This will cause your routes to disappear from Google Maps.

How to fix it: Update your calendar.txt end dates or add new entries in calendar_dates.txt that cover future service. Then re-publish your feed immediately. This is the most common reason transit agencies lose their Google Maps listing.


Location and Shape Errors

stop_too_far_from_shape

What it means: One of your stops is positioned far away from the route shape defined in shapes.txt. Google Maps uses shapes to draw the route line on the map.

How to fix it: Either correct the stop coordinates so the stop is on or near the route, or update your shape to pass through the correct location. A stop more than 100 metres from its shape will trigger this warning.

stop_too_far_from_trip_shape

What it means: Similar to above, but specifically for the relationship between a stop used in a trip and that trip's shape.

How to fix it: Verify that every stop used in a trip is geographically consistent with where that trip travels. A common cause is using the same stop for both directions of a route when the stop positions differ slightly.


Prevent Errors Before They Happen

The best way to deal with GTFS errors is to prevent them from being created in the first place. AddTransit's built-in editor validates your data as you enter it, highlighting problems in real time before they make it into your feed file. You can also set up automatic feed hosting so your published feed stays current without manual intervention.

Agencies that switch from manual GTFS creation to AddTransit typically eliminate 90% of their validation errors on the first export.

Build error-free GTFS feeds with AddTransit

Frequently Asked Questions

Google caches GTFS data and re-processes feeds periodically. After fixing your feed and re-publishing it, allow 24–72 hours for changes to appear in Google Maps. If your feed URL changed, you may need to resubmit through the Google Transit Partner Portal.

Google runs additional quality checks beyond standard validation. Common reasons for Google-specific rejection include: service calendar expiry (no future dates), stops placed in the ocean or other implausible locations, route shapes that do not match the road network, and agency URLs that return errors. Check your feed against Google's own Transit Partner guidelines.

The validator report will include the file name and the row number. Open the file in a spreadsheet application like Excel or Google Sheets — row numbers are displayed on the left. Remember that row 1 is the header row, so row 2 in the validator corresponds to the first data row in your spreadsheet.

Yes. GTFS files are just text files — you can open and edit them in any spreadsheet application. Fix the specific rows with errors and save. Keep a backup copy of your original ZIP before making changes so you can revert if needed.