{"id":"18237e079927c753","repo":"curl/curl","slug":"curl-easy-perform-failed-s-18237e","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-uidl.c","lineNumber":63,"sourceCode":"\n  curl = curl_easy_init();\n  if(curl) {\n    /* Set username and password */\n    curl_easy_setopt(curl, CURLOPT_USERNAME, \"user\");\n    curl_easy_setopt(curl, CURLOPT_PASSWORD, \"secret\");\n\n    /* This is the server URL */\n    curl_easy_setopt(curl, CURLOPT_URL, \"pop3://pop.example.com\");\n\n    /* Set the UIDL command */\n    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, \"UIDL\");\n\n    /* Perform the custom request */\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":45,"sourceCodeEnd":74,"githubUrl":"https://github.com/curl/curl/blob/527573490eb2564b3d7c9dd51d8bff963b5d6303/docs/examples/pop3-uidl.c#L45-L74","documentation":"Printed when curl_easy_perform() fails for a POP3 UIDL custom request (lists messages by unique ID). Like STAT/NOOP the UIDL response is delivered through the command channel; this example does not set CURLOPT_NOBODY, so any failure in connect/auth/UIDL surfaces here. The %s expands to curl_easy_strerror of the returned CURLcode.","triggerScenarios":"Triggered on line 59 of pop3-uidl.c when the UIDL custom request fails. Typical codes: CURLE_COULDNT_CONNECT (port 110), CURLE_LOGIN_DENIED (bad credentials), CURLE_QUOTE_ERROR / CURLE_RECV_ERROR (server returns -ERR to UIDL, or UIDL unsupported per RFC 2449 CAPA), CURLE_PARTIAL_FILE if the listing is truncated mid-stream.","commonSituations":"Server that does not implement UIDL (older or minimal POP3), placeholder pop.example.com never resolves, wrong credentials, network egress blocking POP3, or accidental removal of CURLOPT_CUSTOMREQUEST causing a default LIST instead of UIDL.","solutions":["Decode the appended CURLcode: QUOTE_ERROR -> UIDL rejected/unsupported; LOGIN_DENIED -> credentials; COULDNT_CONNECT -> network/port.","Check CAPA via CURLOPT_VERBOSE to confirm the server advertises UIDL before relying on it.","Verify host reachability on port 110 and the USER/PASS credentials.","Ensure CURLOPT_CUSTOMREQUEST is set to the exact string 'UIDL' (or 'UIDL <n>' for a single message).","Add CURLOPT_USE_SSL = CURLUSESSL_ALL if the server requires encryption before authentication."],"exampleFix":"// before\ncurl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, \"UIDL\");\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: confirm CAPA support, use TLS, and log the exchange\ncurl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, \"UIDL\");\ncurl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);\ncurl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);\nresult = curl_easy_perform(curl);","handlingStrategy":"try-catch","validationCode":"CURL *h = curl_easy_init();\nif (!h) return 1;\nif (curl_easy_setopt(h, CURLOPT_URL, url) != CURLE_OK) { curl_easy_cleanup(h); return 1; }","typeGuard":"static int is_valid_easy_handle(CURL *h) {\n  return h != NULL;\n}","tryCatchPattern":"CURLcode res = curl_easy_perform(h);\nif (res != CURLE_OK) {\n  fprintf(stderr, \"pop3-uidl failed: %s\\n\", curl_easy_strerror(res));\n}\ncurl_easy_cleanup(h);","preventionTips":["UIDL support is server-optional; check the CAPA response before relying on unique-id listings.","Capture UIDL output via a write callback rather than stdout for reliable parsing.","Cache the id mapping locally to avoid repeated full-mailbox UIDL scans."],"tags":["libcurl","pop3","network","curl-easy-perform","custom-request","c"],"analyzedSha":"527573490eb2564b3d7c9dd51d8bff963b5d6303","analyzedAt":"2026-08-01T21:00:26.351Z","schemaVersion":2}