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).
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.
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: Users\<username>\AppData\Roaming\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
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 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 or Windows 10.
- 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 ⌘ 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 ⌘ 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.
Problem still there? It probably means there is a specific problem with the syntax of the tags in the AUP file. Copy the AUP file to another location, then open the file in Notepad++ for Windows and Brackets or BBEdit for Mac and examine if the tags of the file enclosed in angle brackets < > are consistently open and closed and are complete.