Yesterday, my PC Apple Music app suddenly stopped working, displaying a “Could not open library” popup with Error Code -50. Even after force-quitting and restarting the app, the error persisted. The root cause is the “Controlled folder access” feature within Windows Security. Windows Defender mistakenly identifies the Apple Music Library process (AMPLibraryAgent.exe) as an unauthorized program and blocks it. This issue can be resolved immediately by adding the executable file to the Windows Security exceptions list. Here is the summary of why this happens and how to fix it step-by-step.
Analyzing Apple Music Error Code -50: Controlled Folder Access
When I launched Apple Music on my PC, I was greeted with: “An error occurred and the library could not be opened. Error code: -50,” followed by an exit button. Initially, it worked after a reboot, but the issue kept recurring whenever I restarted the app. I realized this was not a simple app bug.
After checking the Windows Task Manager and background processes, I noticed the Windows Security notification system was logging blocked file attempts in real-time. The culprit was the AMPLibraryAgent.exe process.
I checked the “Protection history” tab in the Windows Security app. The blocking criterion was “Controlled folder access.” The Apple Music Library Agent was trying to access the C:\Music directory, but was blocked by Windows Defender’s ransomware protection.
This agent executable manages essential data, including local high-resolution audio files, playlist databases, and album artwork caches. Without read and write permissions for the default music folder, Apple Music cannot guarantee data integrity. It appears the program halts itself to prevent potential file system corruption. I suspect that a recent Windows security update patch caused the process signature to be temporarily flagged as untrusted.
How to Allow Apple Music Through Windows Ransomware Protection
Now that the cause is identified, it is time to have the Windows security system recognize the agent as a safe program. Follow these steps to grant the necessary folder access permissions.
1. Open Windows Security: Click the search icon on the Windows taskbar, type “Windows Security,” and launch the app.
2. Virus & threat protection: Click on the shield icon labeled “Virus & threat protection” in the left menu.
3. Manage ransomware protection: Scroll down to the bottom of the screen and click “Manage ransomware protection.”
4. Access allowed apps: Click “Allow an app through Controlled folder access.” Select “Yes” if a User Account Control (UAC) prompt appears.
5. Add allowed apps: Click the [+ Add an allowed app] button in the center of the screen.
6. Select recently blocked apps: Choose “Recently blocked apps” from the dropdown menu.
※ This is much faster and more accurate than manually digging through the hidden WindowsApps folder.
7. Add the process: Locate AMPLibraryAgent.exe at the top of the blocked list and add it.
8. Restart Apple Music.
Conclusion
After restarting the app, it loaded the audio database smoothly without any error popups. The album list appeared normally, and music playback is perfect.
When software you use daily suddenly stops working, it is natural to suspect a flaw in the app itself. However, if you experience recurring permission errors without a clear reason, I highly recommend checking your Windows Defender protection history.
I hope this serves as a useful guide for my future self and anyone else frustrated by similar permission-blocking issues in a Windows environment.
📸 Behind the scenes
Check out more behind-the-scenes shots on my Naver blog (Korean):
애플뮤직 오류 코드 -50 해결: 윈도우11 보안 차단 1분 만에 푸는 방법
👉 https://blog.naver.com/PostView.naver?blogId=k5kun&logNo=224362385024