{"id":"cb480474a64e4a9f","repo":"curl/curl","slug":"curl-easy-perform-failed-s-cb4804","errorCode":null,"errorMessage":"curl_easy_perform() failed: %s\n","messagePattern":"curl_easy_perform\\(\\) failed: (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"docs/examples/pop3-authzid.c","lineNumber":66,"sourceCode":"    /* Set the username and password */\n    curl_easy_setopt(curl, CURLOPT_USERNAME, \"user\");\n    curl_easy_setopt(curl, CURLOPT_PASSWORD, \"secret\");\n\n    /* Set the authorization identity (identity to act as) */\n    curl_easy_setopt(curl, CURLOPT_SASL_AUTHZID, \"shared-mailbox\");\n\n    /* Force PLAIN authentication */\n    curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, \"AUTH=PLAIN\");\n\n    /* This retrieves message 1 from the user's mailbox */\n    curl_easy_setopt(curl, CURLOPT_URL, \"pop3://pop.example.com/1\");\n\n    /* Perform the retr */\n    result = curl_easy_perform(curl);\n\n    /* Check for errors */\n    if(result != CURLE_OK)\n      fprintf(stderr, \"curl_easy_perform() failed: %s\\n\",\n              curl_easy_strerror(result));\n\n    /* Always cleanup */\n    curl_easy_cleanup(curl);\n  }\n\n  curl_global_cleanup();\n\n  return (int)result;\n}\n","sourceCodeStart":48,"sourceCodeEnd":77,"githubUrl":"https://github.com/curl/curl/blob/527573490eb2564b3d7c9dd51d8bff963b5d6303/docs/examples/pop3-authzid.c#L48-L77","documentation":"Printed at pop3-authzid.c:66 when curl_easy_perform(curl) at line 62 fails. The handle is configured for a POP3 RETR of message 1 from pop3://pop.example.com/1 using CURLOPT_USERNAME/CURLOPT_PASSWORD, CURLOPT_SASL_AUTHZID='shared-mailbox', and CURLOPT_LOGIN_OPTIONS='AUTH=PLAIN'. The example requires libcurl >= 7.66.0 because CURLOPT_SASL_AUTHZID was added then; on older builds the option is silently ignored and auth fails.","triggerScenarios":"Triggered when the POP3 server rejects PLAIN auth (no shared mailbox, wrong credentials, AUTH=PLAIN not advertised), when the server does not exist or refuses the connection, or when libcurl is too old to honor CURLOPT_SASL_AUTHZID. The %s is curl_easy_strerror(result), commonly CURLE_LOGIN_DENIED or CURLE_COULDNT_CONNECT.","commonSituations":"Typo'd username/password/authzid, server not offering PLAIN (so AUTH=PLAIN cannot be negotiated), outdated libcurl predating 7.66.0 silently dropping the AUTHZID option, TLS not enabled so the server refuses PLAIN, or message index '1' not existing in the mailbox.","solutions":["Verify libcurl version >= 7.66.0 (curl --version) since CURLOPT_SASL_AUTHZID is required by this example.","Turn on CURLOPT_VERBOSE and confirm the server advertises SASL PLAIN and that the AUTHZID/username are sent correctly.","Validate credentials and the 'shared-mailbox' authzid against the POP3 server with an IMAP/POP3 client.","Use pop3s:// (implicit TLS) or set CURLOPT_USE_SSL=CURLUSESSL_ALL so PLAIN auth is permitted by the server policy.","Confirm message '1' exists; a missing message can also surface as a perform failure."],"exampleFix":"// before\ncurl_easy_setopt(curl, CURLOPT_URL, \"pop3://pop.example.com/1\");\nresult = curl_easy_perform(curl);\nif(result != CURLE_OK)\n  fprintf(stderr, \"curl_easy_perform() failed: %s\\n\",\n          curl_easy_strerror(result));\n\n// after - require TLS for PLAIN auth and surface the numeric code\ncurl_easy_setopt(curl, CURLOPT_URL, \"pop3s://pop.example.com/1\");\ncurl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);\nresult = curl_easy_perform(curl);\nif(result != CURLE_OK)\n  fprintf(stderr, \"curl_easy_perform() failed: %s (code %d)\\n\",\n          curl_easy_strerror(result), (int)result);","handlingStrategy":"validation","validationCode":"/* Pre-validate credentials, authzid, and SASL support before perform */\nif(!username || !*username || !password || !*password) {\n    fprintf(stderr, \"missing POP3 credentials\\n\"); return -1;\n}\nif(!authzid || !*authzid) {\n    fprintf(stderr, \"missing SASL authzid\\n\"); return -1;\n}\n/* CURLOPT_SASL_AUTHZID needs libcurl >= 7.66.0 */\nif(curl_version_info(CURLVERSION_NOW)->version_num < 0x074200) {\n    fprintf(stderr, \"libcurl too old for SASL_AUTHZID\\n\"); return -1;\n}","typeGuard":null,"tryCatchPattern":"result = curl_easy_perform(curl);\nif(result == CURLE_LOGIN_DENIED) {\n    fprintf(stderr, \"auth rejected (bad user/pass/authzid) - do NOT retry\\n\");\n} else if(result != CURLE_OK) {\n    fprintf(stderr, \"curl_easy_perform() failed: %s\\n\", curl_easy_strerror(result));\n}","preventionTips":["Confirm the server actually advertises SASL PLAIN (enable CURLOPT_VERBOSE to see the exchange).","Validate username, password and authzid are non-empty before perform.","Require libcurl >= 7.66.0 for CURLOPT_SASL_AUTHZID (check version_num).","Use pop3s:// (TLS) so credentials are not sent in the clear.","Never retry CURLE_LOGIN_DENIED - it is a permanent credential/config error."],"tags":["libcurl","curl-easy-perform","pop3","sasl","authentication","c"],"analyzedSha":"527573490eb2564b3d7c9dd51d8bff963b5d6303","analyzedAt":"2026-08-01T21:00:26.351Z","schemaVersion":2}