168

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.

Andrew Stubbs
  • 455
  • 3
  • 9
clamp
  • 1,242
  • 8
  • 27
  • 41
  • 3
    Strangely, 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 Dec 21 '09 at 17:24
  • 2
    This happens to me occasionally. And I lose my settings as well. This is going for a few years at least. – Halil Özgür Sep 27 '12 at 06:27
  • It happens occasionally. Each time I follow the steps in the [accepted answer](http://superuser.com/a/67143/66293), 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 Feb 03 '16 at 08:47

6 Answers6

222

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.

antzshrek
  • 560
  • 1
  • 5
  • 19
Rob3C
  • 328
  • 1
  • 5
  • 9
  • 25
    Worked 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 Dec 14 '09 at 15:28
  • 2
    Me too. Zero, too. – PA. Dec 14 '09 at 15:43
  • 1
    My langs.xml looked like it had been truncated after like the 30th line for some reason. Rob3C's fix worked great! – Hardwareguy Jan 23 '10 at 17:15
  • 6
    Mine 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 Jan 26 '10 at 20:07
  • Mine was zero too. This is under Windows 2003. – jammus Jan 27 '10 at 10:41
  • 1
    Mine was zero - xp/32bit - maybe wiped after a crash – Antony Feb 21 '10 at 04:38
  • 3
    Mine was zero length too. Windows 7, x64. – Andrew Mar 14 '10 at 08:41
  • I also had a truncated langs.xml. But this fix worked like a charm. – thijs Jun 15 '10 at 08:01
  • 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 Jul 20 '10 at 17:09
  • Same here, mine got truncated somwhere in the middle of the file. Could it be some kind of crash white writing the preferences? – t3mujin Oct 15 '10 at 15:08
  • Solved!!, You are the best!, Half the file was missing! – Kevin Boyd Oct 20 '10 at 06:36
  • 1
    This 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 Nov 03 '10 at 09:04
  • Windows 7, x64 here; mine was truncated at about line 50. – MT_Head Dec 23 '10 at 21:32
  • 1
    0 length on Windows 7 32-bit here, so not just a 64-bit version problem. – houbysoft Feb 22 '11 at 23:17
  • 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 Mar 04 '11 at 16:22
  • Yup Win7/32 here and the same issue. Only things I'd changed with respect to languages were file extension associations. – CJBrew Mar 11 '11 at 11:21
  • 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 Jul 05 '11 at 21:31
  • I ended up reinstalling. – Daniel Schaffer Jul 05 '11 at 21:40
  • 1
    The 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 Nov 11 '11 at 17:59
  • 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 Mar 14 '14 at 03:08
  • Also had to do this for stylers.xml. – littleturtle Apr 16 '15 at 18:05
  • 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 Jun 29 '15 at 11:17
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++ 
random
  • 14,638
  • 9
  • 54
  • 58
Seth Spearman
  • 1,389
  • 6
  • 20
  • 21
  • This worked for me. The file had been truncated, so was invalid XML. – JV01 Jan 12 '11 at 10:01
  • 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 Jul 05 '11 at 14:54
  • 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 Nov 16 '11 at 01:00
  • 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ý Aug 26 '15 at 19:24
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
  • 258
  • 1
  • 5
  • 12
3

The other answers did not work for me.

Uninstalling and reinstalling npp did the trick.

nimcap
  • 1,636
  • 4
  • 16
  • 21
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
  • 121
  • 3
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
  • 223,558
  • 70
  • 607
  • 592
  • 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 May 15 '14 at 12:50