{"record":{"id":"78a6c914b03f127d","repo":"yt-dlp/yt-dlp","slug":"could-not-access-playlist-error-code-message","errorCode":null,"errorMessage":"Could not access playlist: {error_code} {message}","messagePattern":"Could not access playlist: (.+?) (.+?)","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"yt_dlp/extractor/bilibili.py","lineNumber":1793,"sourceCode":"    def _real_extract(self, url):\n        list_id = self._match_id(url)\n\n        bvid = traverse_obj(parse_qs(url), ('bvid', 0))\n        if not self._yes_playlist(list_id, bvid):\n            return self.url_result(f'https://www.bilibili.com/video/{bvid}', BiliBiliIE)\n\n        webpage = self._download_webpage(url, list_id)\n        initial_state = self._search_json(r'window\\.__INITIAL_STATE__\\s*=', webpage, 'initial state', list_id)\n        error = traverse_obj(initial_state, (('error', 'listError'), all, lambda _, v: v['code'], any))\n        if error and error['code'] != 200:\n            error_code = error.get('trueCode')\n            if error_code == -400 and list_id == 'watchlater':\n                self.raise_login_required('You need to login to access your watchlater playlist')\n            elif error_code == -403:\n                self.raise_login_required('This is a private playlist. You need to login as its owner')\n            elif error_code == 11010:\n                raise ExtractorError('Playlist is no longer available', expected=True)\n            raise ExtractorError(f'Could not access playlist: {error_code} {error.get(\"message\")}')\n\n        query = {\n            'ps': 20,\n            'with_current': False,\n            **traverse_obj(initial_state, {\n                'type': ('playlist', 'type', {int_or_none}),\n                'biz_id': ('playlist', 'id', {int_or_none}),\n                'tid': ('tid', {int_or_none}),\n                'sort_field': ('sortFiled', {int_or_none}),\n                'desc': ('desc', {bool_or_none}, {str_or_none}, {str.lower}),\n            }),\n        }\n        metadata = {\n            'id': f'{query[\"type\"]}_{query[\"biz_id\"]}',\n            **traverse_obj(initial_state, ('mediaListInfo', {\n                'title': ('title', {str}),\n                'uploader': ('upper', 'name', {str}),\n                'uploader_id': ('upper', 'mid', {str_or_none}),","sourceCodeStart":1775,"sourceCodeEnd":1811,"githubUrl":"https://github.com/yt-dlp/yt-dlp/blob/81ecd58b1394793e6da9998cc19fdb45657f1685/yt_dlp/extractor/bilibili.py#L1775-L1811","documentation":"The catch-all branch of BilibiliPlaylistIE's initial-state error handling: the playlist page reported a failure code that is not -400 (watchlater login), -403 (private list) or 11010 (deleted). The error surfaces bilibili's numeric trueCode and message verbatim, so the number in the text is the server's own reason and is the key to diagnosis.","triggerScenarios":"A /medialist/play URL whose initial state carries an unlisted error code: malformed mlid, list visible only to logged-in followers, region restriction, or transient anti-crawler interference with the page itself.","commonSituations":"No cookies passed for semi-private lists; playlist id mistyped or truncated when copied; bilibili introduced a new error code the extractor does not special-case yet; page served in a degraded variant to datacenter IPs.","solutions":["Read the numeric code in the message and match it: not-found-family codes mean a bad mlid, permission-family codes mean login is required.","Pass cookies: yt-dlp --cookies-from-browser firefox <url> (SESSDATA carries the playlist access).","Open the URL in a browser logged in as the owner/follower to see the real page state.","Update yt-dlp in case newer builds map this code to a clearer error.","Retry after a pause if the browser also shows a verification/captcha interlude - it is risk control, not the playlist."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"import re\nfrom yt_dlp.utils import DownloadError\n\ntry:\n    extract(url)\nexcept DownloadError as e:\n    m = re.search(r'Could not access playlist: (-?\\d+)', str(e))\n    if m:\n        code = int(m.group(1))\n        if code == -403:\n            supply_owner_cookies()\n        else:\n            log_and_skip(url, code)","preventionTips":["Pass SESSDATA cookies whenever downloading bilibili playlists to cover private/follower lists.","Parse the numeric trueCode out of the message to branch (permission vs not-found vs new code).","Update yt-dlp so newly introduced codes map to precise errors."],"tags":["bilibili","playlist","api-error","yt-dlp"],"backgroundTag":"api-status-code-error","analyzedSha":"81ecd58b1394793e6da9998cc19fdb45657f1685","analyzedAt":"2026-08-22T12:21:25.439Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}