Notepad++ is unable to load langs.xml, why?

167

37

Whenever I open NotePad++ the following error message appears:

---------------------------
Configurator
---------------------------
Load langs.xml failed!
---------------------------

That obviously means that there is also no syntax highlighting.

My OS is Windows 7 64-bit.

clamp

Posted 2009-11-07T12:48:05.240

Reputation: 1 074

It happens occasionally. Each time I follow the steps in the accepted answer, but it's still annoying. In my latest attempt, I denied myseld write rights to langs.xml, so hopingly the file doesn't get truncated now.

– GolezTrol – 2016-02-03T08:47:52.273

2This happens to me occasionally. And I lose my settings as well. This is going for a few years at least. – Halil Özgür – 2012-09-27T06:27:13.510

3Strangely, I had the same problem. And the interesting thing was the highlighting worked when I selected the language manually. Anyways, the accepted answer seems to fix the problem completely. – anand.trex – 2009-12-21T17:24:41.917

Answers

220

Somehow, your langs.xml has errors in it. Perhaps while exploring various Notepad++ options you accidentally made unintended changes to it. That's what happened to me.

Go to the installation folder for Notepad++ and rename langs.xml to langs.xml.bad. Then, in that same folder, find langs.model.xml, make a copy of it, and rename the copy to langs.xml. DO NOT simply rename the file or you will not have it available the next time you need it.

also replace this file in the folder C:\users\(user)\appdata\roaming\notepad++

You will want to then compare the langs.xml to langs.xml.bad and see if there is anything legitimate that you want back.

If you are missing the langs.model.xml file, you can download the current version from the svn repo.

Rob3C

Posted 2009-11-07T12:48:05.240

Reputation: 178

1My langs.xml looked like it had been truncated after like the 30th line for some reason. Rob3C's fix worked great! – Hardwareguy – 2010-01-23T17:15:56.050

6Mine was zero too. Are all you zero-byte file guys on Windows 7 x64, perchance? I wonder if there's a Notepad++ bug around this. I swear I haven't mucked around with the settings.. – Blorgbeard is out – 2010-01-26T20:07:39.503

Mine was zero too. This is under Windows 2003. – jammus – 2010-01-27T10:41:28.857

1Mine was zero - xp/32bit - maybe wiped after a crash – Antony – 2010-02-21T04:38:55.030

Also had to do this for stylers.xml. – littleturtle – 2015-04-16T18:05:08.067

3Mine was zero length too. Windows 7, x64. – Andrew – 2010-03-14T08:41:44.007

Since Notepad++ has added the option for storing settings in cloud storage i.e. DropBox, OneDrive, GoogleDrive, make sure that if you have the Settings -> Preferences -> Clouds -> Settings on cloud option turned on you update the langs.xml file in the Notepad++ directory on the root of your cloud storage folder. – Ian Stanway – 2015-06-29T11:17:20.267

I also had a truncated langs.xml. But this fix worked like a charm. – thijs – 2010-06-15T08:01:21.417

mine was zero length too, win7, x64. seems like it started happening after an update (or maybe a failed update?)

This worked great. – John Gardner – 2010-07-20T17:09:25.300

Same here, mine got truncated somwhere in the middle of the file. Could it be some kind of crash white writing the preferences? – t3mujin – 2010-10-15T15:08:17.150

Solved!!, You are the best!, Half the file was missing! – Kevin Boyd – 2010-10-20T06:36:32.077

1This solves it (+1), but I am very sure I did not edit this file or play with options before the error appeared. – Jan Willem B – 2010-11-03T09:04:56.090

Windows 7, x64 here; mine was truncated at about line 50. – MT_Head – 2010-12-23T21:32:03.167

10 length on Windows 7 32-bit here, so not just a 64-bit version problem. – houbysoft – 2011-02-22T23:17:10.413

Yeah, this solves it, but it's the second time I have to do it, so I expect to have to repeat the procedure in near future. Maybe I should setup a scheduled task to fix it everyday? – Trinidad – 2011-03-04T16:22:46.660

Yup Win7/32 here and the same issue. Only things I'd changed with respect to languages were file extension associations. – CJBrew – 2011-03-11T11:21:24.897

Win7/64 here. My langs.xml file appeared to be perfectly valid XML. Diffing against langs.model.xml produced a few differences, but it looked like they were all possibly the result of upgrades, as I don't remember making any of the changes. However, even after copying all the differences into langs.xml, it still failed. Replacing langs.xml with a copy of langs.model.xml still didn't help. I ended up just deleting langs.xml, and it seems to stop the error from happening, though there's no syntax highlighting. This is Notepad++ v5.9 – Daniel Schaffer – 2011-07-05T21:31:38.277

I ended up reinstalling. – Daniel Schaffer – 2011-07-05T21:40:01.750

1The newest version of Notepad++ automatically restores langs.xml if you delete the file. You may have to look in your AppData/Roaming/Notepadd++ folder. – Will Shaver – 2011-11-11T17:59:03.033

25Worked here, too. As an aside, I'd mention the fact that my langs.xml file had no "errors" as such.. it was blank! Size, zero. Sadly, I wasn't able to reproduce the behaviour which caused it to be wiped clean. – TataBlack – 2009-12-14T15:28:06.250

2Me too. Zero, too. – PA. – 2009-12-14T15:43:46.460

After my laptop crash and reboot, I had this problem (the langs.xml contains all NULL character). By delete or renaming these 2 files, it works ! – Dio Phung – 2014-03-14T03:08:49.953

37

I had the same problem but I had to replace the langs.xml in the following path to fix it.

C:\Users\<username>\AppData\Roaming\Notepad++

For those on a current Windows release:

%appdata%\Notepad++ 

Seth Spearman

Posted 2009-11-07T12:48:05.240

Reputation: 1 389

This worked for me. I used Notepad++ zip version (rather than installer). I think installer ensures existency of xml files is Roaming directory, so without installer one has to copy them manually. It has nothing to do with XML corruption. – Tomáš Záluský – 2015-08-26T19:24:52.543

This worked for me. The file had been truncated, so was invalid XML. – JV01 – 2011-01-12T10:01:13.317

This one worked for me, Windows7 64bit. In the installation folder (C:/Program Files(x86)/Notepad++ was the langs.model.xml but no langs.xml.

Thanks – Alfabravo – 2011-07-05T14:54:37.017

Same here. First tried the accepted answer. There was no langs.xml in the install folder, but there was in this roaming directory. Suggest first finding which situation fits you by locating the corrupted langs.xml, then copying the model into its place. – Robert Kerr – 2011-11-16T01:00:45.783

8

I had the same error message, but a different issue - the langs.xml file was OK. Replacing it with langs.model.xml did not fix the problem.

To fix the problem, I had to open langs.xml in Notepad++ (running as Admin on Windows7 to be able to save in ProgramFiles). Then, from the Encoding menu, I saw the file is saved as ANSI. The XML declaration specifies 1252 charset. So I re-encoded the file by selecting Encoding -> Character sets -> Western european -> Windows-1252. Then I made a small change to the file and re-saved it.

I suspect this is related to the default codepage of the system.

Marek

Posted 2009-11-07T12:48:05.240

Reputation: 248

3

The other answers did not work for me.

Uninstalling and reinstalling npp did the trick.

nimcap

Posted 2009-11-07T12:48:05.240

Reputation: 1 366

Yes, in my case the files langs.xml didn´t even exist. – daniel_aren – 2016-08-31T07:08:05.587

0

I got this error when I used the ZIP version (no installer). Renaming files and reinstalling did not work for me.

Try running the exe with "Run As Administrator" and then say Yes when it asks to fix the config.xml file. This worked for me.

integris

Posted 2009-11-07T12:48:05.240

Reputation: 121

0

This answer was taken from a rejected edit and it was not written by me:

Not a full proof solution as it can happen again.

"Do not use environment variable %APPDATA%" can be selected on Windows 7 installations, but seems to be ignored. Langs.xml seems to always be put in %APPDATA%. (Is this confusion the cause of the bug?)

Copy the new %APPDATA%\Langs.xml to %APPDATA%\Langs.model.xml and put a copy in Program Files\Notepad++.

Copy %APPDATA%\Langs.model.xml or ProgramFiles\Notepad++\Langs.model.xml to %APPDATA%\Langs.xml if the problem occurs again – not foolproof but it's a workaround.

A foolproof solution would be to fix the bug causing Langs.xml to be corrupted.

slhck

Posted 2009-11-07T12:48:05.240

Reputation: 182 472

No, the file will never be placed directly under %APPDATA%, instead it may be in the %APPDATA%\Roaming\Notepad++ folder, or in the root folder of the application. Also, you suggest to copy the broken langs.xml on top of langs.model.xml. do not do that, it will break permanently, instead, copy the other way around, as suggested in the accepted answer and leave the langs.model.xml, which is untouched, where it was. – Abel – 2014-05-15T12:50:26.307