Fix RunKeeper Exporting Invalid GPX Files

Leading on from my previous post about exporting RunKeeper data it has come to light that RunKeeper doesn’t always export valid GPX files for each workout which will obviously cause problems when you attempt to load them up in other services including Endomondo (which I am now using in place of RunKeeper).

I had exported over forty workouts in GPX format and three were invalid. GPX files are simply text files in XML format which makes fixing them a snap. Commonly, errors with XML file validity stem from a problem with the order of tag nesting or tags that are not closed properly (the latter of which is the issue with RunKeeper and some of its exports).

The simplest solution is as follows:

  1. Load an affected GPX file in a text editor,
  2. Locate the first <trkseg> tag,
  3. Search for subsequent <trkseg> tags and ensure that there is a </trkseg> tag on the line above and, if it’s absent, add a </trkseg> tag,
  4. Repeat until you get to the end of the file,
  5. Save the file.

Try uploading the GPX file to your service of choice and you should find that there should no longer be any problems.


  1. I wanted to merge three activities to one. So I fixed the error with the closing tags, but when I now try to upload the .gpx-file to Runkeeper the activitiy shows the right distance, but the wrong duration and starting time. Do you know how to fix this problem?

    1. Just something off the top of my head – are the activities in chronological order? Weird stuff might happen if they are out of order.

Leave a Reply

Your email address will not be published.