Can't open .txt files - "Session file is either corrupted or not valid"
-
$5 PayPal bounty for feedback that leads to solution
I’m about to abandon Notepad++ :(
-
This is resolved. Previous attempts to reinstall the app did not fix it, but an explicit uninstall deleted whatever corrupt/invalid setting affecting my .text files (it asks if you want to delete your settings and preferences).
Theory: “Smart Sync” one-way sync’ing with Dropbox was misleading me to believe I deleted the XML config files completely, but Notepad++ was still accessing them on the cloud directly (I enabled this option). My backup directory was specified as Dropbox originally, so perhaps some sequence of changing around these settings caused the snafu (e.g., perhaps severed the link to the config files moments after they were modified).
-
a late welcome to the notepad++ community, @Derek-Clark90
i apologise that you didn’t get your request, about your corrupted session files, answered.
i can’t explain, on how your request could have slipped through all eyes, as you wrote it in a clear and understandable manner, with enough information to give a response, and without any reason not to respond.but i’m glad that you didn’t give up on notepad++ (never give up, never surrender) and big thumbs up for taking the time to share your solution and details to your dropbox setup 👍👍👍
-
Thanks! I was optimistic that a post specific to an error message would help others in the future. I was by no means disgruntled; just a little desperate!
-
Solved
I deleted this in
config.xml
:
<PluginDlg pluginName="Notepad++::InternalFunction" id="0" curr="3" prev="-1" isVisible="yes" />
Step-by-Step:
Try this if on Windows:
Method 1
Quick- Hold down the Windows key and press
r
for the Run dialog. - Type (or preferably copy and paste this):
notepad.exe %appdata%\Notepad++\config.xml
- Delete the
PluginDlg
line if present.
Method 2
A bit more descriptive-
In Explorer, at the top showing location, type
%appdata%
and hit [Enter]. -
That’s simply a wildcard for … like this in my case:
C:\Users\garyha\AppData\Roaming
-
From there, a directory for Notepad++ should be visible. Double-click it.
-
Open the file
config.xml
in Notepad++ if you can, or notepad.exe or other editor. -
Delete the
PluginDlg
line if present.<GUIConfig name="DockingManager" leftWidth="200" rightWidth="200" topHeight="200" bottomHeight="209"> <PluginDlg pluginName="Notepad++::InternalFunction" id="0" curr="3" prev="-1" isVisible="yes" /> <ActiveTabs cont="0" activeTab="-1" /> <ActiveTabs cont="1" activeTab="-1" /> <ActiveTabs cont="2" activeTab="-1" /> <ActiveTabs cont="3" activeTab="-1" /> </GUIConfig>
Method 3
Cause the entire config.xml file to be regenerated- With Notepad++ closed, navigate to be able to see
%appdata%\Notepad++\config.xml
and rename it to something likeconfig.xml.off
- Open Notepad++
Method 4
Scorched earth- Rename the whole directory
%appdata%\Notepad++
to something like%appdata%\Notepad++_off
- Open Notepad++
That should recreate the entire directory structure with defaults. I presume settings, macros or any user changes will be lost.
Notes
There are quite a few pages describing this problem, I chose this one for providing the answer that worked for me because it was the top result in a google search for me right now.
I was not able to open python files..py
. Fine now.
Hopefully this will help toward a permanent fix so this won’t be afflicting people, since it would be tough for Notepad++ devs to address this unless they were hitting it (aside from having someone zip up their directory structure and supply it to them, recommendable for such problems by the way).
How I found this:
I started looking atsession.xml
but my changes there had no effect, instead onlyconfig.xml
seems to affect this.
Made a copy of the Notepad++ directory, opened Notepad++ to generate a virgin copy of it, swapped back to the broken version, opened the two session.xml files in CompareIt to see their differences, removed lines in the broken version one at a time or sometimes a group at a time, then the same for config.xml, basically. Once all done, essentially wound up with no changes except that one line removed.I greatly appreciate Notepad++, it has changed my life for the better, a lot.
Couple things that would be appreciated:
- A response from Notepad++ thanking me for my efforts here, and that will encourage me to care in the future similarly.
- Notepad++ representative addressing whether this makes sense to them vis-a-vis that setting as the cause, or whether it may also have to do with other related settings to any degree of certainty, whether the problem can be confidently considered to be only in
config.xml
, and if there will be a fix, or has been a fix in ____ version, and most importantly, who done it? Or, how did that setting show up? Is it possible I really did something to cause that yesterday? Or is there a simpler fix people could use instead of deleting the entire line? Even better, could they fix their situation very very simply by merely activating the Plugin Dialog in some way to cause the line to be rewritten in some way? I thought about placing the bad line back in there and tinkering around, just kind of tuckered out.
If anyone is curious, there’s some description regarding PluginDlg at http://docs.notepad-plus-plus.org/index.php/Editing_Configuration_Files
Thanks.
- Hold down the Windows key and press
-
Correction:
< Made a copy of the Notepad++ directory ... > Renamed the Notepad++ directory ...
-
@Gary-Hawkins Thanks! I had to go all the way to Method 3. I had two PluginDlg lines, and deleting each one did not work. Removing config.xml did. Thanks!
-
@Gary-Hawkins Method 3 worked perfectly. Thanks!
-
I too encountered this problem for some reason. Method 3 fixed it for me. (Though method 1 and 2 are really the same).
Then it broke the next again the next day! I did change something in my Preferences:
MISC. Session file ext: txt - broke it. Remove that and it worked again.I would try this first if you have it in your configuration. Method .5 ?
-
Hello, @dr-smockovich and All,
When you choose an extension for your session or your project files, you must type in an extension which does not exist yet in your system !
For a better security, just choose extensions different from all those described in this Wikipedia article :
https://en.wikipedia.org/wiki/List_of_filename_extensions
And, of course, if you’re using project files, its extension must be different from the session files extension, too :-)
For instance, if you choose
txt
as session files extension, as soon as you open any.txt
file, Notepad++ will try to interpret it as a session file. Of course, almost always, this operation fails because your.txt
file has not the same format that the regularsession.xml
!Best Regards,
guy038
-
@guy038 said in Can't open .txt files - "Session file is either corrupted or not valid":
When you choose an extension for your session or your project files, you must type in an extension which does not exist yet in your system !
I think I saw a suggestion of
nps
for this recently?
nps = Notepad+ Plus Session (although that’s a bit awkward) -
@DR-Smockovich , @guy038 , @Alan-Kilborn , and others:
Why limit yourself to a three-letter extension? Windows lost the old 8.3 requirement from DOS decades ago. In at least one previous discussion I participated in, the OP called them NXML (for Notepad++ XML) files, with
.nxml
extension. In that same discussion, @dinkumoil showed he uses.nppssn
-
Why limit yourself to a three-letter extension?
Maybe because after years of conditioning, that just feels best? :-)
The world has shown that it is much more fond of losing the “8” than it is the “3”.But, yes, if one has the freedom, and in this case one does, going longer makes sense. And since 6 fit well in the box, that seem nice.
-
DR Smockovich is correct.
The problem only occurred when I changed the setting in:
Notepadd++ > Settings > MISC > Session file extension, and Workspace file extension
They were blank. I changed them to “.php” thinking it would then save files in .php extension rather than me having to type out the extension every time I saved a file.
That is not so.
I removed and cleared those two settings to make them blank again and viola, the probelm of the original poster went away (session corrupted etc).
If you’re attempting to get notepad to save in a particular file extension every time you save a file by default, then click on:
Save As… > Append Extension (little tick box by the “save” button).
Have a good day :)