MutagenError: [Errno 13] Permission denied

I have a weird problem on my Windows 10 (Home Edition) computer where I manage my music. I’m running Picard Version 2.8.5. Windows has long file names enabled (set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\ LongPathsEnabled (dword) to 1). This is also set in the Picard settings.

I have all necessary permissions (full control + all other file permissions) on the source AND the destination folder, but I keep getting permission errors whenever I try to save files with updated tags.

The files are not write-protected.

I tried to create an exception in Avast but that doesn’t solve the problem either.

Here’s an example debug log from such event:

D: 17:03:43,029 formats\vorbis._save:240: Saving file 'D:\\Music\\MB\\orig\\cd\\Purcell, H; Beznosiuk, P, Podger, R, Coin, C,\\Sonatas of Three Parts, 1683, Z790-801 [2008]\\01 Trio Sonata in 3 parts No 1 in G minor, Z 790.flac'
E: 17:03:43,034 util\thread.run:66: Traceback (most recent call last):
  File "mutagen\_util.py", line 250, in _openfile
PermissionError: [Errno 13] Permission denied: 'D:\\Music\\MB\\orig\\cd\\Purcell, H; Beznosiuk, P, Podger, R, Coin, C,\\Sonatas of Three Parts, 1683, Z790-801 [2008]\\01 Trio Sonata in 3 parts No 1 in G minor, Z 790.flac'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "util\thread.py", line 63, in run
  File "file.py", line 380, in _save_and_rename
  File "formats\vorbis.py", line 334, in _save
  File "mutagen\_util.py", line 184, in wrapper
  File "mutagen\_util.py", line 153, in wrapper
  File "contextlib.py", line 113, in __enter__
  File "mutagen\_util.py", line 271, in _openfile
mutagen.MutagenError: [Errno 13] Permission denied: 'D:\\Music\\MB\\orig\\cd\\Purcell, H; Beznosiuk, P, Podger, R, Coin, C,\\Sonatas of Three Parts, 1683, Z790-801 [2008]\\01 Trio Sonata in 3 parts No 1 in G minor, Z 790.flac'

E: 17:03:43,044 ui\item.error_append:108: <FLACFile '01 Trio Sonata in 3 parts No 1 in G minor, Z 790.flac'>: [Errno 13] Permission denied: 'D:\\Music\\MB\\orig\\cd\\Purcell, H; Beznosiuk, P, Podger, R, Coin, C,\\Sonatas of Three Parts, 1683, Z790-801 [2008]\\01 Trio Sonata in 3 parts No 1 in G minor, Z 790.flac'
D: 17:03:43,045 file.update:721: Updating file <FLACFile '01 Trio Sonata in 3 parts No 1 in G minor, Z 790.flac'>

Any hints on what I could try?

Usually this still means you have either missing permissions or the readonly flag set, either on the files or the folders where the files reside. Please double check that.

On Windows 11 there is another possibility, not sure if this also applies to Windows 10 (but I think it does): If you have enabled the Controlled Folder Access in the Ransomware Protection settings (somewhere in the settings app) than Windows blocks any write to specific folders, including your users Document, Music etc. folders.

If that’s the case there should be a notification in the Windows notification area after you tried to save a file with Picard. The notification should give you an option to open the settings. If not you can also go to the settings and search for Controlled Folder Access. There should be a link to the blocking history, which will give you a list of the last attempts of applications trying to write to protected folders. If there are entries for picard.exe you can allow access for that app. Afterwards it should be possible to save with Picard again.

See also Ransomware protection in Windows Security - Microsoft Support

2 Likes

Since I have Avast the default Microsoft Defender app is disabled. That’s probably why I can’t access “Controlled Folder Access” from the Settings app.

I don’t get notifications from Avast either so I’m at a loss.

Simple test - try and save it at 250 chars instead of 299 to the same location and it will confirm if this is a long filename issue. Even if you have set that flag in the registry it is not normal for Windows to like going over 260.

The path length shouldn’t trigger these permission errors. If enabled in Picard’s options it supports writing such paths (but you might have issues accessing those paths with other software). If disabled Picard will truncate the paths to fit the 255 character limit

I remember you working on this before, so doubt this is Picard. But it is a test that should be done in this case. “permission” errors are the kinda errors that spit out when the OS freaks out at long file names. And this is a Home OS. I get it with people trying to download things from OneDrive with monster folder names. It says “permission” when it should say “too darn long”.

The error is going to be the same and it is too much of a coincidence this is a really long path here.

A simple test - go to the same folder and try and edit something with notepad with a filename as long. That would also confirm that this is not a “permissions” type error. (My fairly standard Win10 Enterprise OS happily created and edited a text file in that location. Even with LongPathsEnable=0)

As I had created the folder, I now edited two FLACs with that name at that location too. Picard perfectly happy (and I had not even enabled long filename support in Picard… ).

2 Likes

The problem has been solved by logging in as a different user.

There’s apparently no way to address this by editing the security policy at folder level.

1 Like