{"record":{"id":"1eda7e3f91e3aec8","repo":"yt-dlp/yt-dlp","slug":"invalid-login-credentials","errorCode":null,"errorMessage":"Invalid login credentials","messagePattern":"Invalid login credentials","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"error","filePath":"yt_dlp/extractor/iwara.py","lineNumber":55,"sourceCode":"\n    def _get_user_token(self):\n        username, password = self._get_login_info()\n        if not username or not password:\n            return\n\n        user_token = IwaraBaseIE._USERTOKEN or self.cache.load(self._NETRC_MACHINE, username)\n        if not user_token or self._is_token_expired(user_token, 'User'):\n            response = self._call_api(\n                'user/login', None, note='Logging in',\n                headers={'Content-Type': 'application/json'}, data=json.dumps({\n                    'email': username,\n                    'password': password,\n                }).encode(), expected_status=lambda x: True)\n            user_token = traverse_obj(response, ('token', {str}))\n            if not user_token:\n                error = traverse_obj(response, ('message', {str}))\n                if 'invalidLogin' in error:\n                    raise ExtractorError('Invalid login credentials', expected=True)\n                else:\n                    raise ExtractorError(f'Iwara API said: {error or \"nothing\"}')\n\n            self.cache.store(self._NETRC_MACHINE, username, user_token)\n\n        IwaraBaseIE._USERTOKEN = user_token\n\n    def _get_media_token(self):\n        self._get_user_token()\n        if not IwaraBaseIE._USERTOKEN:\n            return  # user has not passed credentials\n\n        if not IwaraBaseIE._MEDIATOKEN or self._is_token_expired(IwaraBaseIE._MEDIATOKEN, 'Media'):\n            IwaraBaseIE._MEDIATOKEN = self._call_api(\n                'user/token', None, note='Fetching media token',\n                data=b'', headers={\n                    'Authorization': f'Bearer {IwaraBaseIE._USERTOKEN}',\n                    'Content-Type': 'application/json',","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/yt-dlp/yt-dlp/blob/81ecd58b1394793e6da9998cc19fdb45657f1685/yt_dlp/extractor/iwara.py#L37-L73","documentation":"Raised as an expected error by the Iwara extractor when a `user/login` API call returns HTTP-successfully but carries no `token` and its `message` contains 'invalidLogin' - i.e. the email/password taken from .netrc were rejected by the server.","triggerScenarios":"Calling any Iwara extractor with credentials while IwaraBaseIE._USERTOKEN is unset/expired and the cached token for that username is missing, and the supplied email/password pair is wrong. The check is a substring match of 'invalidLogin' in the API's message field.","commonSituations":"Wrong or outdated credentials in ~/.netrc (machine iwara), a password changed since the .netrc entry was written, typos, or .netrc permission/format problems causing garbage to be sent.","solutions":["Fix the .netrc entry: `machine iwara login <email> password <password>` (file must be readable only by you, chmod 600)","Verify the same email/password actually logs in at iwara.gg in a browser","Check for stray quotes/spaces in the .netrc line being sent as literal characters","If credentials are fine, update yt-dlp in case the login endpoint changed"],"exampleFix":"# ~/.netrc - before (wrong password)\nmachine iwara login me@example.com password hunter2\n# after\nmachine iwara login me@example.com password correct-horse-battery","handlingStrategy":"validation","validationCode":"def netrc_entry_valid(machine: str, login: str, password: str) -> bool:\n    # cheap pre-flight: confirm the credentials still work via the same endpoint\n    import json, urllib.request\n    req = urllib.request.Request(\n        'https://api.iwara.tv/user/login',\n        data=json.dumps({'email': login, 'password': password}).encode(),\n        headers={'Content-Type': 'application/json'})\n    resp = json.load(urllib.request.urlopen(req))\n    return bool(resp.get('token'))","typeGuard":null,"tryCatchPattern":"try:\n    info = ydl.extract_info(url, download=False)\nexcept ExtractorError as e:\n    if 'Invalid login credentials' in str(e):\n        alert('iwara .netrc password is wrong - update ~/.netrc')\n    else:\n        raise","preventionTips":["Validate the .netrc entry after any password change","Keep ~/.netrc at chmod 600 with exactly 'machine iwara login <email> password <pw>'","Confirm browser login works before blaming the extractor"],"tags":["iwara","authentication","invalid-credentials","netrc","yt-dlp"],"backgroundTag":"invalid-credentials","analyzedSha":"81ecd58b1394793e6da9998cc19fdb45657f1685","analyzedAt":"2026-08-22T12:21:25.439Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}