{"record":{"id":"23ccfc074defa422","repo":"soimort/you-get","slug":"server-returned-an-error-s-incorrect-password","errorCode":null,"errorMessage":"Server returned an error: %s (Incorrect password?)","messagePattern":"Server returned an error: (.+?) \\(Incorrect password\\?\\)","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"error","filePath":"src/you_get/extractors/baidu.py","lineNumber":293,"sourceCode":"        init_url.split('?', 1)[1], int(time.time()))\n    refer_url = init_url\n    fake_headers = {\n        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',\n        'Accept-Charset': 'UTF-8,*;q=0.5',\n        'Accept-Encoding': 'gzip,deflate,sdch',\n        'Accept-Language': 'en-US,en;q=0.8',\n        'Host': 'pan.baidu.com',\n        'Origin': 'http://pan.baidu.com',\n        'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:13.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2500.0 Safari/537.36',\n        'Referer': refer_url\n    }\n    opener.addheaders = dict2triplet(fake_headers)\n    pwd_resp = opener.open(verify_url, bytes(\n        parse.urlencode(post_pwd), 'utf-8'))\n    pwd_resp_str = ungzip(pwd_resp.read()).decode('utf-8')\n    pwd_res = json.loads(pwd_resp_str)\n    if pwd_res['errno'] != 0:\n        raise AssertionError(\n            'Server returned an error: %s (Incorrect password?)' % pwd_res['errno'])\n    pg_resp = opener.open('http://pan.baidu.com/share/link?%s' %\n                          init_url.split('?', 1)[1])\n    content = ungzip(pg_resp.read()).decode('utf-8')\n    sign, timestamp, bdstoken, appid, primary_id, fs_id, uk = baidu_pan_parse(\n        content)\n    psk = query_cookiejar(cookiejar, 'BDCLND')\n    psk = parse.unquote(psk)\n    fake_headers['Cookie'] = cookjar2hdr(cookiejar)\n    return sign, timestamp, bdstoken, appid, primary_id, fs_id, uk, fake_headers, psk\n\n\ndef cookjar2hdr(cookiejar):\n    cookie_str = ''\n    for i in cookiejar:\n        cookie_str = cookie_str + i.name + '=' + i.value + ';'\n    return cookie_str[:-1]\n","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/soimort/you-get/blob/049548f3f3f35e67ba8d3181c71fdc71d11cf260/src/you_get/extractors/baidu.py#L275-L311","documentation":"Raised as AssertionError inside baidu_pan_protected_share (src/you_get/extractors/baidu.py:293). This function verifies the share password by POSTing to Baidu's verify endpoint; a nonzero errno in the JSON response means the password was rejected (or the verify request itself was malformed), so the code aborts with '(Incorrect password?)'.","triggerScenarios":"Calling baidu_pan_download on a password-protected pan.baidu.com share where the supplied password is wrong: the POST to the verify URL returns JSON with errno != 0. Also triggered when the verify endpoint response format changes and errno is nonzero/unexpected.","commonSituations":"Typo in the share password; stale password copied from an old post; Baidu adding extra captcha/verification the script cannot satisfy, surfacing as a nonzero errno.","solutions":["Double-check and re-enter the correct share password.","Confirm the password manually on pan.baidu.com in a browser for the same URL; if the browser also fails, the share/password pair is wrong.","If the password is right but it still fails, Baidu likely added extra verification — update baidu_pan_protected_share or upgrade you-get."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    baidu_pan_download(url, password=pwd)\nexcept AssertionError as e:\n    if 'Incorrect password' in str(e):\n        pwd = prompt_user_for_password(url)  # re-ask, never loop blindly\n    else:\n        raise","preventionTips":["Confirm the password in a browser before automating.","Treat repeated failures as captcha/verification issues, not retryable ones."],"tags":["you-get","baidu","authentication","password","extractor"],"backgroundTag":null,"analyzedSha":"049548f3f3f35e67ba8d3181c71fdc71d11cf260","analyzedAt":"2026-08-15T03:58:15.069Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}