My computer will not open a project i have been working on for weeks! it is coming up with an error of

Project file read error: unexpected end of file at line 1 column 1 for file C:/Users/xxxx/Documents/Nxxxx/Exxxx.qgs

Is there anyway to get it back?

  • Was this file made with an earlier version of QGIS? I have had problems opening older files after upgrading Quantum.
    – s_a
    Sep 13 '12 at 14:20
  • You can also look at the project file, since it is text based (XML). Sep 13 '12 at 14:26
  • How do i look up the project file? It was created on an earlier one but think it crashed when i tried to save.
    – Ger
    Sep 13 '12 at 14:37
  • Just follow the path mentioned in the error path. The file is a text file, so you can open it with any text editor. I'm using notepad++ for such things. once installed, you can open every file with it by right-clicking in the explorer.
    – AndreJ
    Sep 13 '12 at 17:18

Just encountered same problem (error while saving, couldn't reopen project) and mostly resolved it --> Open your .qgs project file with a text editor (e.g. notepad, notepad++, textedit) and it should show the xml markup.

The 'unexpected end of file' is because the application did not finish saving the end of the document, and so there are xml tags that were not closed. Add closing tags where needed, for example my file needed: /maplayer /projectlayers properties /properties /qgis

It will be easier if you can open a project file that is working with notepad as well to compare the differences.

hope this helps.


I have encountered this error before and it has just occurred again. QGIS crashed before my project could be saved. When I attempted to re-open the project I got the same error as above. The project file was empty (0k).

I found the actual project data was stored in a file (which may be hidden on your system - if so, you need to enable view hidden files) with the same project name, but called yourfilename.qgs~.

To recover, I opened the .qgs~ file in Wordpad and then saved it immediately as the .qgs file, overwriting the empty .qgs file. I closed Wordpad, launched QGIS and reopened the project - no problem.

Using Windows 7 home 64bit and QGIS 2.4.0 64 bit.

  • 1
    You just saved me a lot of time! Any idea why it happens?
    – H.Wiener
    Dec 1 '14 at 11:55
  • Me too - great answer.
    – Ben Mayo
    Dec 16 '14 at 13:52
  • Great answer. Unfortunately this bug has persisted across updates, and even without QGIS crashing.
    – deepwinter
    Jul 25 '15 at 17:51
  • No idea why it happens @H.Wiener. Sep 27 '15 at 23:51
  • I have not had this problem for a while @deepwinter. The only major change I have made was switching to QGIS standalone 32 bit. Sep 27 '15 at 23:52

Your data is not in the .qgs file, but in shapefiles or spatialite databases you added to the project. So your data is not lost.

You can always create a new project, and add the same layers as before. Only styling may be lost. You can save that too in a file, if it is worth saving.

  • I know this. it is just that there is an amount of data that i do not wish to have to rebuild. which is what i ended up doing in the end.
    – Ger
    Oct 16 '12 at 9:27

To recover, open both file the '.qgs~' and '.qgs' file in Notepad. Copy the HTML (all text inside the '.qgs~') file and then paste it into the '.qgs' file, save it. Open your newly saved file using your QGIS desktop. Then your problems will disappear.

  • 1
    Fyi, it's not HTML, it's XML.
    – underdark
    Jun 4 '15 at 9:24
  • Renaming the xyz.qgs~ to xyz-SAVED.qgs might be easier. With Project -> Save As ... you can then overwrite the broken project file.
    – AndreJ
    Sep 4 '15 at 14:59
  • Alternative:I simply deleted the .qgs and changed the file extension for the .qgs~ to .qgs and opened that and it loaded fine. Just saved once it opened
    – Chris
    Feb 19 '16 at 1:57
  • This worked perfectly for me. thank you for you simple and easy to follow instructions. Sep 23 '16 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.