Repository navigation
fix: show the real cause when browser cookies can't be read - #144
Conversation
yt-dlp prints "could not find <browser> cookies database" both when the profile is missing and when the OS refuses to list the folder (macOS privacy protection after an update). A broad frontend regex matched "cookie ... database" and showed the "Chrome is currently open" dialog, so closing the browser never helped. - New error codes YT_COOKIE_ACCESS_DENIED and YT_COOKIE_PROFILE_NOT_FOUND. The backend probes the profile folder from the error path to tell a blocked folder from a missing profile, in both the download path and parse_ytdlp_error. - The frontend picks the dialog by error code; only Windows lock and DPAPI/App-Bound failures still match by message. - BrowserCookieErrorDialog has three variants: blocked (macOS opens the Full Disk Access settings), missing profile (opens settings to pick a profile) and locked. All text is translated in 13 locales. - Tests for the classification, changelog entries, error code docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 610d73c325
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| // Only the Windows lock / decryption failures. Keep this narrow: a broad "cookie … database" | ||
| // match used to show the "browser is open" dialog for unrelated errors such as a missing profile. | ||
| const DB_LOCKED_PATTERN = /could not copy.*cookie|failed to decrypt.*dpapi|app.bound.encryption/i; |
There was a problem hiding this comment.
Route explicit cookie permission failures to access denied
If yt-dlp reports an explicit Permission denied ... cookies error instead of the could not find ... cookies database form classified by the backend, the error reaches this helper as a generic error and returns null. The previous callers recognized permission-denied cookie messages, so these failures now skip the dedicated access-denied guidance; add a narrow permission-denied mapping.
Useful? React with 👍 / 👎.
Summary
Users with cookies from browser enabled kept getting the "Cookie Access Failed — Chrome is currently open" dialog, even after closing Chrome. The logs showed a different error:
yt-dlp prints this both when the profile is missing and when the OS refuses to list the folder. The second case is what happened here: macOS privacy protection (TCC) blocked reading Chrome's data after an OS update, and yt-dlp's directory walk silently found nothing. The frontend matched this with a broad regex (
cookie.*database|failed to.*cookie|…) meant for the Windows "database locked" case. As a result it showed the "close your browser" dialog, which could never help.Changes
Backend
YT_COOKIE_ACCESS_DENIEDandYT_COOKIE_PROFILE_NOT_FOUND.classify_missing_cookie_db()reads the path from yt-dlp's message and probes the profile folder and its parent:PermissionDenied→ access denied (macOS: Full Disk Access needed)build_download_error_message(download path) andparse_ytdlp_error.infer_error_codemaps the message to profile-not-found when no path check is possible.YT_COOKIE_DB_LOCKEDstill covers only the real "could not copy … cookie database" case.Frontend
src/lib/cookie-errors.tschooses the dialog by error code. Only Windows lock and DPAPI/App-Bound failures are still matched by message. The broad regex is gone fromDownloadContextandUniversalContext.BrowserCookieErrorDialoghas three variants, and all its text now goes through i18n:open_macos_privacy_settings). The steps mention that dev builds need the terminal app to have the permission. Other systems get generic permission guidance.chrome://version.backend-error.tshas the new codes as non-retryable, plus message inference.common.cookieErrorDialogand the twobackendErrors). Changelog in EN/VI/ZH-CN, anddocs/backend-error-codes.md.Notes for reviewers
tauri devthat is the terminal/IDE that started it, nottarget/debug/youwee, which is ad-hoc signed and changes on every rebuild. The dialog text covers this case.Test plan
tsc, bun tests (118, including newtests/cookie-errors.test.ts) andcargo checkpass (pre-commit hook)cargo testpasses (238), with new tests for blocked parent/profile folders, missing profile, unrelated errors, message-only inference, and the download error pathYT_COOKIE_ACCESS_DENIED🤖 Generated with Claude Code