Skip to content

fix: catch exceptions when clearing addon store download directory on init#19776

Closed
seang1121 wants to merge 2 commits intonvaccess:masterfrom
seang1121:fix/19202-addon-dl-dir-exception
Closed

fix: catch exceptions when clearing addon store download directory on init#19776
seang1121 wants to merge 2 commits intonvaccess:masterfrom
seang1121:fix/19202-addon-dl-dir-exception

Conversation

@seang1121
Copy link

Fixes #19202

Summary

When the _dl (addon store download) directory exists but has broken permissions (e.g. caused by a cloud backup tool like Google Drive locking the folder), shutil.rmtree raises a PermissionError that propagates uncaught through module initialisation. Because this happens at import time, NVDA crashes immediately with a CRITICAL - core failure, then the watchdog restarts it — creating a crash loop with no recovery path.

The fix wraps the rmtree + mkdir block in a try/except that logs the error with log.exception and continues. The add-on store may not be fully functional without a clean download directory, but NVDA itself will start successfully and the user can investigate.

Changes

  • source/addonStore/network.py: wrap the download directory cleanup and creation in a try/except inside AddonFileDownloader.__init__

Test plan

  • Simulate a permission error on the _dl directory (%appdata%\nvda\addonStore\_dl) and confirm NVDA starts without crashing
  • Confirm the error is logged via log.exception in the NVDA log
  • Confirm normal add-on store behaviour is unaffected when permissions are fine

@seang1121 seang1121 requested a review from a team as a code owner March 11, 2026 02:45
@seang1121 seang1121 requested a review from seanbudd March 11, 2026 02:45
@seanbudd
Copy link
Member

Closing. This PR seems fully AI generated without human review or consideration. Please fill out our PR template rather than using your own/AI template. Please ensure you perform and confirm proper testing.

Read our contributing guide for more information.

@seanbudd seanbudd closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

handle cases where '_dl' directory fails to delete in addon store init

2 participants