FAQ:Errors on opening or recovering an Audacity project
Contents
- Error: not well-formed (invalid token) at line x
- Reference to invalid character number at line x
- Attempting to import an Audacity Project
Error: not well-formed (invalid token) at line x
- The project contains imported files whose metadata (like artist or genre) contains control characters. This mostly occurs with iTunes files on Mac where the project was created in an older version of Audacity.
- The project was saved containing non-English or accented characters using an old ANSI build of Audacity for Windows. ANSI builds are not properly Unicode aware, so do not support non-English or accented characters.
- The latest version of Audacity will always fully support Unicode. You can check your Audacity version at (or on Mac).
- Bill 11May12: What are we talking about in the box below? Is it when Audacity crashes without completely writing the AUP? I've seen one of those on the forum where the AUP file just stopped without closing a number of tags. "In some cases"? Doesn't Audacity wait to delete the temp files before it completes writing of the saved file? What does "if this does not happen" mean?
- Gale 11May12: Bill, thanks for picking up on this. It is intentionally vague. Yes, this is usually when there is a crash on saving, but I have seen a number of cases where there was no (reported) crash; Audacity just writes an .aup file that terminates prematurely in nulls (or is even completely nulls). So this latter case is really moonphase saving problems as per what used to be called bug 137.
If the crash occurs at the last step of saving (when (re)writing the .aup itself) this will almost certainly result in "invalid token" if the .aup is opened. The question is not I think what happens to the temp files - if the project was never saved before, the temp files (I believe) are moved to a newly created _data folder for the project in the early stages of saving. The question is whether the autosave file that recovery depends on is retained until the .aup file is correctly written.
From user reports I have seen, a crash that leaves a corrupted .aup file will sometimes initiate a crash recovery and sometimes not, possibly because there is no proper test of whether the .aup is valid before deleting the autosave file (that is speculation). This behavior is probably one of a number that should be follow-up moonphase bugs branching out from bug 137.
- Bill 11May12: Tried rewriting it.
- Gale 21Nov13: Added steps for removing NULL line at end of autosave file and suggested there that this may help correcting an AUP file corrupted for unknown reasons. Replaced the advice div with a note div at the end of this FAQ on other options if all else fails.
Solution for error caused by control characters
- Make a copy of the AUP project file and open it in a text editor. You can use the default Notepad on Windows or TextEdit on Mac, but in a few instances these could change the AUP file in such a way that Audacity could no longer open it. We recommend instead Notepad++ for Windows and Brackets or BBEdit for Mac.
- Turn word wrap off in the menus (or in TextEdit, drag the window horizontally so that lines do not wrap).
- In the line indicated in the error message, look for one of these:
- projname=
- name=
- value=
- title=
then remove all characters inside the quotation marks that follow which are not a number or an A to Z letter. You could also change those characters to a number or A to Z letter. For example, a string of control characters you would want to remove or change might start with &# followed by four numbers and a semi-colon, such as &# 0 0 1 3 ;.
- Save the changes to the .aup file.
- If you re-open the project and an error occurs at another line, repeat the steps above in the new line indicated in the error message.
<tag name="GENRE" value="Drama &# 0 0 0 9 Comedy"/>
And the same line corrected so that the two words can be read into the project:
<tag name="GENRE" value="Drama, Comedy"/>
"Drama 0009 Comedy", though meaningless, would also enable the project to be opened correctly.|
If you had to rename "projname" in the AUP file, rename both the AUP project file and the corresponding _data folder so that they have the same name as "projname" in the AUP file. |
Solution to correct an AUP file created in an ANSI version of Audacity, preserving non-English characters
- Make a copy of the file
- Open the file in Notepad++ (a free text editor that supports UTF-8 encoding of Unicode characters)
- Choose
- Save the changes to the file.
- Gale: later - done and uncommented - a nightmare for users if they have to convert the AUTOSAVE file. One has already had to, hence why I wrote this. Perhaps the conversion steps could move to Wiki but that is not very friendly.
Solution to remove redundant lines in an AUTOSAVE recovery file or AUP file
- Find the autosave file. It will be in an "AutoSave" folder in Audacity's folder for application data as follows:
- Windows 10/Windows 8/Windows 7/Windows Vista: Users\<username>\AppData\Roaming\Audacity\
- Windows XP: Documents and Settings\<username>\Application Data\Audacity
- OS X/macOS ~/Library/Application Support/audacity/
- Linux: ~/.audacity-data/ .
- Make a copy of the AUTOSAVE file as a backup and move the copy somewhere else such as your Desktop.
- If the AUTOSAVE file was created by Audacity 2.1.1 or later, it must be converted to XML format before it can be edited in a text editor. Follow the steps to convert the AUTOSAVE file to XML then return to step 4 below.
- Open the AUTOSAVE file in a text editor like Notepad (Windows) or TextEdit (Mac).
- Turn word wrap off in the menus (or in TextEdit, drag the window horizontally so that lines do not wrap).
- Go to the line indicated in the error message. If you had been recording, the last line above it will probably look like </recordingrecovery>.
- We need to delete the entire line. It may be a long line containing only empty spaces or it may have </project> at the end of all the spaces. Hold Shift and press Down to select the entire line before pressing Delete. Ensure this leaves you with a final line that contains only </project>. Ensure this is the only line that contains </project>.
- Save the changes to the file.
Converting the AUTOSAVE file to XML
|
Exit Audacity before attempting these steps. |
Windows:
- In the AutoSave folder, right-click the AUTOSAVE file and choose "Cut".
- Go to the folder Audacity is installed in, such as "C:\Program Files (x86)\Audacity", then right-click in empty space and choose "Paste". Provide the administrator password if asked.
- Open an administrator command prompt. On Windows XP, Vista or Windows 7, click Windows Start, go to All applications > Accessories, then right-click the Command Prompt shortcut and select "Run as Administrator". Or see instructions for Windows 8.
- Assuming the prompt in the command window shows some location in C:\ and Audacity is installed in some location in C:\, type "cd" (without quotes) then a space. If Audacity is on some other drive than the prompt indicates, type the name of that drive letter and a colon (such as D:), press Enter, and then type "cd" (without quotes) then a space.
- Go up one level in Explorer then drag the icon for the Audacity installation folder into the command window. The path "C:\Program Files (x86)\Audacity" (or whatever it is) will appear. Press Enter to change the prompt to the path you dragged in.
- At the end of the path, type "audacity" (without quotes), a space, then "/d" (also without quotes), another space, then drag the AUTOSAVE file into the command window. Here is what an example should look like:
C:\Program Files (x86)\Audacity> audacity /d "C:\Program Files (x86)\Audacity\My Project - 2015-07-01 14-12-35 N-2.autosave" - Press Enter. You can see in Explorer that the AUTOSAVE file has been updated.
- Now you can cut the AUTOSAVE file from the Audacity installation folder, and paste it into the AutoSave folder. Now you can make corrections to the file in a text editor.
Mac OS X/macOS:
- In the AutoSave folder, right-click or Control-click the AUTOSAVE file and choose the option to Copy.
- Go to the folder Audacity.app is installed in, such as /Applications/Audacity, hold Command and Option then press V to move the AUTOSAVE file alongside Audacity.
- Right-click over Audacity.app then choose "Show Package Contents".
- Open the "Contents" folder then the "Mac OS" folder.
- Open a Terminal then drag the Audacity file in the "Mac OS" folder into the terminal to display the path to that Audacity file.
- Then at the end of the file path, type a space, "-d" (without quotes) and another space then drag the AUTOSAVE file into the Terminal.
- Press Enter to convert the file. You will see a message that the file has been decoded successfully.
- In the "Mac OS" folder, right-click or Control-click the AUTOSAVe file and choose the option to Copy.
- Go to the "AutoSave" folder, hold Command and Option then press V to move the converted AUTOSAVE file back into the AutoSave folder. Now you can make corrections to the file in a text editor.
GNU/Linux:
- Open a terminal.
- Assuming Audacity is installed, type "audacity -d" (without quotes) then a space, then type the path to the AUTOSAVE file (or drag the AUTOSAVE file into the terminal). Here is an example:
audacity -d "home/al/.audacity-data/AutoSave/My Project - 2015-07-01 14-12-35 N-2.autosave" - Press Enter to convert the file. You will see a message that the file has been decoded successfully. Now you can make corrections to the file in a text editor.
- Ask for help on the Audacity Forum and attach the AUP or autosave file.
- Try to recover the project manually, if it is an unedited recording.
Reference to invalid character number at line x
- The project contains imported files whose metadata contains symbols that Audacity cannot display. This may create either the "(invalid token)" or "invalid character number" error
- The project was saved containing non-English or accented characters using an old ANSI build of Audacity for Windows. ANSI builds are not properly Unicode aware, so do not support non-English or accented characters.
- The latest version of Audacity will always fully support Unicode. You can check your Audacity version at (or on Mac).
Solution:
- Make a copy of the AUP project file and open it in a text editor. You can use the default Notepad on Windows or TextEdit on Mac, but in a few instances these could change the AUP file in such a way that Audacity could no longer open it. We recommend instead Notepad++ for Windows and Brackets or BBEdit for Mac.
- Turn word wrap off in the menus (or in TextEdit, drag the window horizontally so that lines do not wrap).
- In the line indicated in the error message, look for one of these:
- projname=
- name=
- value=
- title=
then remove all characters inside the quotation marks that follow which are not a number or an A to Z letter. You could also change those characters to a number or A to Z letter. For example, a string of control characters you would want to remove or change might start with &# followed by four numbers and a semi-colon, such as &# 0 0 1 3 ;.
For symbols there will usually be five characters between the &# and a colon.
- Save the changes to the .aup file.
- If you re-open the project and an error occurs at another line, repeat the steps above in the new line indicated in the error message.
<tag name="GENRE" value="Country &# 0 0 0 9 Western"/>
And the same line corrected so that the two words can be read into the project:
<tag name="GENRE" value="Country, Western"/>|
If you had to rename "projname" in the AUP file, rename both the AUP project file and the corresponding _data folder so that they have the same name as "projname" in the AUP file. |
"Error importing" when opening an AUP file?
This error occurs because you have attempted to open an Audacity project by using the Import command (which is reserved for use with audio files).
Instead, you should always use to open an AUP (Audacity Project) file. If you attempt to use to open a project, an "Error Importing" message will appear, asking you to use File > Open... instead.
If you see "Error Importing" even when using File > Open..., this usually means the AUP file is seriously damaged, or most likely, empty. You can check this by opening the AUP file in a text editor like Notepad or TextEdit (on Mac). The AUP file is saved last, so an empty AUP file can occur if you shut down the computer or close the lid on a laptop before the project is completely saved. Be sure to wait until the Audacity Status Bar says the project is saved, or until all project save progress dialogues have closed, before shutting down the machine.
If the AUP file is empty, try to use any backup you created, such a different AUP file for an earlier stage of the project, or an exported WAV file. Failing this, you can try manual recovery of the project's _data folder, but this only works for unedited recordings.