How to Fix GPX File Errors

I thought I'd share my problems, and how I fixed them. I hope this helps anyone else having trouble uploading their activities.

Every now and then, one of my runs wouldn't upload - the automatic sync (from my android phone) would fail, and the manual upload would give an error.

After exporting the file (to a .gpx on the sd card), transferring it to my computer, and studying it with a text editor, I realised there were problems with the times recorded:


1) some data points had incorrectly formatted times, eg:

(WRONG) <time>2013-01-15T08:015:52.822Z</time>  instead of:

   (RIGHT) <time>2013-01-15T08:15:52.822Z</time>  (the extra character causes the time to be invalid)


2) the time itself would occasionally jump forward or backwards by anywhere from 30 seconds to 2 hours, which causes problems.

e.g. the times for successive points would be something like this:



I fixed these errors by simply deleting any entry with an incorrect time. After doing this, the manual upload worked. Of course, the hard part is finding all the errors. I used this tool to find invalid XML entries:

I then wrote a python program that read in the gpx file, and checked all the times, deleting any entries that were more than a few seconds different from the surrounding ones. I have put the code here:

The cause of this problem is almost certainly my dodgy phone going crazy when recording times.

Was this article helpful?
6 out of 6 found this helpful
Have more questions? Submit a request


  • If you got the file on github or something it would be cool to try the python program, got a corrupted file so been trying to find out what wrong with it

    Best regards

    Gerhard Sletten

  • Hi Myall


    I would be very interested to see your python scripts as well if its available.




  • I've added a link to the code. Let me know if there are any problems with it.

  • HI,

    my issue comes from the time as well:

    <time>2014-08-06T10:33:34.000+0200</time> instead of <time>2014-08-06T10:33:34.000Z</time>....

    Could you tell me where this issue can come from and how I can fix it. For the few runs that I have done with the mistakes, It might take me 3 hours to change all the correct times...

    Thanks for your help



  • I have a similar problem. When I upload a gpx created using another app (Run.gps) the start time (and all other times) shown in Strava is one hour later than the actual time. The gpx file always uploads without problems, the time stamp appears to be the correct format (e.g. <time>2014-08-20T10:11:02.827Z</time>), and when I uploaded it to any other program/website the time is shown correctly? I am (currently) in the UK on BST, but I presume Strava takes it timezones from the initial longitude value?

    Any ideas anyone? Much appreciated.

  • I posted the following comments on the "features request page" entitled Attach a Route (map) when entering a 'Manual Entry'

    I've reposted it below as the solution I discovered also works for the issue discussed here, namely the easy editing/manipulation/correction of GPX time codes and other GPX errors.

    1. Goto
    2. Take your GPX/TCX file (either exported from Strava Route Builder/your own GPS/other mapping software) and drag it into the main map window to load it up.
    3.  Open the "Window-Toolbox" and you will find a whole host of excellent utilities to edit your files. Here you can reset the date/time of your ride, set an average speed along with loads more options.
    4. Export out the file, ensuring its in GPX format (the TCX option does'nt appear compatible with Strava).
    5. Add a new activity in Strava by uploading the resultant GPX file.


  • Today I find the solution! I had always the problem until i found this awesome page:

    i tested this way: create a route on google map and copy link into that website and set this options:

    Add estimated fields: Speed, Distance and Pace

    And important is this one:
    Geotag points with time but no position: NO!

    i don't try it with timestamps but u can delete it. I read this article so often and now i want that you all now there is a way :-)

  • I just fixed an export from run keeper, it had an extra tag in the middle where it didn't belong. I opened it in notepad++ and found a < trkseg > out of place, deleted it and saved, uploaded fine. But i am familiar with editing code. I just compared it to a properly formatted gpx file from the past to see the anomaly.

  • Thanks Phil Ware, just followed your instructions and looking through the 'Toolbox' options after loading the .gpx into 'MyGPS' shows where the time issue is and putting it right is merely a case of inserting a start time. At least that's how easy it was for me, then manually upload activity to Strava as a .gpx file.

  • @Phil Ware and @Michael C: This almost worked for me. Here are the tweaks it takes to get it there.
    1. As of yesterday, "mygpsfiles" web app creates time tags in the wrong date format. Besides being wrong, Strava will reject entries which show future dates e.g.: 2017-11-03TxxxxZ is November 3, instead of the March 11 I entered with mygpsfiles.
    2. Without time tags for all the track points, Strava thinks you must be at least in a car (or time machine) because you cover the entire route in 0 seconds. Strava will flag it because you'll take KOM for everything in your path.

    The process with FIXES
    a. Use Google to create the route, then bring it into mygpsfiles
    b. Use the toolbox to FIRST enter a start time.
    c. use the toolbox to enter a SPEED. Be very conservative here because you're going to hit the leader boards with your faked times. I was replacing a missing chunk of data from having my damn app paused in the middle of a ride. I simply took the average time from the remainder of the ride and applied it to the entire track I'm "faking".
    d. Save off the file (doesn't work on Linux/Chrome, I had to use Linux/Firefox)
    e. Open in your favorite text editor. CTRL-H (replace) all instances of incorrect time tags (in my case: "11-03" with "03-11"). This will correct all your time tags at once.
    f. Save and import the doctored gpx file into Strava

  • Curt,

    Strange...i don't seem to get the date issues that you do, plus mapmygps works fine with Chrome on a PC!

    In fact I used my original work flow to upload a strava time yesterday, so I know that it still works as I originally described. With regards setting a correct average time all you need to do is use the toolbox function to set your average speed. With some trial and error you can easily set the time to any value you want/need. As long as your average speed is realistic for running, Strava doesn't mind.

    Perhaps the problems you encountered are Linux ones, because I have been using this workaround extensively and haven't run into any of your problems!.

    Phil Ware

  • I got an error with my attempt to fix the gpx with the script:

    Traceback (most recent call last):
    File "C:\Users\Me\Downloads\", line 147, in
    File "C:\Users\Me\Downloads\", line 63, in fix_gpx_file
    first_pt = get_decimal_time(points[0][2])
    IndexError: list index out of range

  • I haven't been keeping track of this thread sorry.
    Ray, it's probably because the gps file hasn't been read properly. I've put in some lines to print info which should help figure out what is going on - try the new version and let me know what is printed out:

Please sign in to leave a comment.