Error: Invalid Token (644) AND corrupted (static) files, export to WAV not available

Windows 10 user, running the latest version (2.3.2) – > I gotta major problem, I accidentally disconnected my device while Windows was updating. This was on my friend’s computer and I thought little of it at first as I only opened one mp3 file (not connected to audacity whatsoever)

Now I have at least 3 project files with corrupted/static data, all from tracks I worked on in the last week and a half. The static cuts in and out. This wouldn’t be the biggest problem, as I have backed up the data outside of the program at least once in wav files… However, Audacity now crashes every time I try to export one of the files, corrupted or not.

Worse still, I have a huge project file that won’t open at all with message “Error: invalid token (line 644)” – I have looked around the forums but could not find this exact error.

Things I have done so far:

  • uninstalled/reinstalled Audacity (nothing happened as I was already running the latest version)
  • tried exporting wavs as I mentioned, program crashed
  • saved recovered file after crash

I love using Audacity but this is so distressing, I may have to give up and stick to FL Studio from now on. I just prefer Aud because I’ve been using it longer. I had problems earlier this year with the “save as” glitch corrupting my files irreparably, and now this. Help!!!

https://forum.audacityteam.org/search.php?keywords=error+invalid+token

There are lots and lots of posts on this topic. The line where it happens is just the first line in the file where you’re getting corrupted. It doesn’t have to do with audacity, but the project that you’re trying to open. Make a copy of your project as a backup, then try opening the original .aup with an editor like notepad++, find the appropriate line, and see what’s there. The fix can be as simple as literally deleting the line, or may be something more complex.

Here’s the wiki’s file on the problem too.

https://manual.audacityteam.org/man/error_not_well_formed_invalid_token_at_line_x.html

OK, thanks, I just freaked out, sorry… The invalid token error actually went away and I was able to open the file after another reboot.

However, the program is still crashing when I try to export some tracks as wav. Also, the static remains on a few tracks but as widespread as before.

Adding: I am reluctant to use “save as” on a file that is already saved, because this caused major glitches in either previous version, or the version before that.

Reluctant or not, you probably won’t have any issues using save as.

Going to need some clarification, otherwise we’re going to be taking less accurate stabs at the dark. You say you have static. Is that static when you record something new, or is that static added to files you’re opening? Is it on every file, or just a select few?

When did Audacity crash? Just trying to open the export window, when actually performing the export? Is it only crashing when you try to export to certain folders? Does it happen on a new recording, or just one of the ones you had issues with due to the critical power failure?

  • The static is on the already recorded tracks – there will be some data that is unaffected on a track, then a blast of static that is visible in the waveform as a huge block. It is not on every single track, and it not every project file. It appears mostly on tracks that were not recorded within the project, but imported. But these files WERE saved within the project after importing.

  • Program crashed while the export was in progress, it got to almost 100% and then closed. I tried several folders, on two external drives and also C drive. This has only happened on the projects I had issues with so far, I haven’t done any new recording since. Once again, it’s not every file within the project, but it happens regardless of static corruption or not. None of the static-affected files will export.

I accidentally disconnected my device while Windows was updating.

To read this back to you, you changed the machine while it was doing an operating system update. That’s scary.

I would be checking the system for errors. You can start by doing a clean start. Shift-Shutdown, wait and then Start. That should either fix or identify any errors in the system. It may take a while and you may get some messages. A clean start checks everything except possibly drive errors and I would be checking that, too.

You might do this before any more work gets damaged.

Koz

Thanks guys. So here’s what happened – I checked both C and external drives for errors and repaired them. What I got back was a handful of missing block files with about 5-10% data loss on one project. Annoying, but not a devastating loss.

I certainly know better than to disconnect a drive like that, it was purely an accident! What I should’ve done is scanned & repaired the drives immediately, this might have prevented the data loss. This might seem like a no-brainer for most of you, but I panicked! Anyway thanks again.

One more thing!

I’m trying to fix the corrupted files, but I still can’t edit or export them. There are patches of silence in left and right channels at different times – mix stereo to mono does not work, the program crashes. Mix and render, export to wav, export to mp3, all cause the program to crash. I couldn’t find anything in the FAQ or the forums about editing or exporting damaged files like this. I’ve had this happen in older versions of Audacity and I was able to fix it with mix/render to mono.

Did you read the link I posted that sent you to the wiki? It tells you to go into the .aup and deleting a line in your file.

I did it read it, but I’m no longer getting that error message and when I open in Wordpad++ there aren’t any special characters anywhere near the 644 line.
(see attachment)

The only issue I’m having now is exporting/editing the files with missing data, and I did not find anything on the forum where the exporting problem was related to the missing data. All files that are still intact have no problem exporting. Files that have little as 2 seconds of missing data cause Audacity to crash while exporting.
line.jpg

A couple of versions ago (2.2.1?) there was a problem using “Save As” to overwrite the current project. It was not a problem to use “Save” to overwrite the current project, or to use “Save As” to save as a new project, only using “Save As” to overwrite the current project. This problem was fixed in the next release and is no longer a problem (though it remains the case that “Save As” is intended for saving as a new project).

OK, so while you can, open that project and use “Save As” to save it to a different disk / storage medium. At this stage I don’t trust the drive that it was on.

So you’re saying that errors were found? Was that on all drives or only one?

Errors were found on the external drive, and were apparently fixed successfully. I agree this drive probably can’t be trusted anymore, at least with this project. No errors found on C drive (as this wasn’t the computer the drive was disconnected from)

I did go ahead an re-save the file on C drive, but ran into the same exact problems trying to export the damaged files.

I’ll mention that I have dealt with missing data in the past after a crash, but I was easily able to fix the damaged files by converting them to mono, and had no problems with export.



It sounds like you have widespread data corruption on that drive.

If you think of a drive as a sheet of paper that is written on and read, disk checking utilities check that the paper is intact, and that the writing is visible. They don’t check that the writing makes sense. So you can have a drive that is physically “fixed”, but the data on it may still be garbage.

Audacity saves it’s audio data as “block files” in the project’s “_data” folder. If any of those block files are damaged, even just one byte, then the entire block is likely to be read as garbage (noise or silence). That “garbage” may be unwriteable, which would account for Audacity choking when trying to export.

This sounds like it’s going to be a salvage operation.
Do you have a disk that is known to be good (undamaged and problem free) and has plenty of free space?

Yikes, at least I can easily get another drive if I have to.

But why wouldn’t it work after being re-saved to C-drive? The same exact problem? There are no issues that I’m aware of on this drive.

I was able to salvage the non-corrupted tracks as wavs with no problem, so I can move them anywhere if I have to. I also have backups of the corrupted files but I have done quite a bit of work since then and I was hoping to save the effects and envelopes.

Thanks for trying to help, seems a likely solution is to export what I can from the project and use another drive.

Corrupt audio data is often, but not always, visible in the Audacity track, either as noise or as silence.

When copying / re-saving a project to another drive, the data is copied literally. There is no error checking other than ensuring that the data is written.

When exporting from Audacity, the audio data passes through an “exporter library”, which formats / encodes the data for whatever the export format is. For example, when exporting as MP3, the raw audio data is passed to the LAME library, which encodes the data and writes the MP3 file to disk. If the data is not valid audio data, then the exporter will fail, and could even crash, taking Audacity down with it.

If a project contains corrupt audio data, it is sometimes possible to export parts of the project using “Export Selected Audio” and recover most of the project - it all depends on how much data is corrupted, and how badly.

Yes, thank you… I was able export and save 90% of the project with “selected audio”, and that’s great. Now off to buy another Seagate. Sigh!

The affected drive is probably recoverable (once you’ve got the data off it) by reformatting it.