Error codes

From Facebook Developers Wiki

Jump to: navigation, search

Contents


Each method call to the API may return an error instead of the expected result due to possible bugs in either the application's code or Facebook's servers. On this page, you can find all of the potential errors that could be returned, as well as the functions which can return them.

In the PHP client, these are thrown as exceptions. If you want to degrade gracefully, you will need to catch them appropriately.

[edit] Overview

If you pass in a malformed or invalid request, an error result will be returned. This is detectable by checking if the root element is of type error_response. Within this element, an error code and explanatory message are returned, as well as all of the parameter names and values of the original request.

In the example below, we see the error returned when an otherwise-valid request is made from an unauthorized IP address.

[edit] Example return XML

<?xml version="1.0" encoding="UTF-8"?>
<error_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
  <error_code>5</error_code>
  <error_msg>Unauthorized source IP address (ip was: 10.1.2.3)</error_msg>
  <request_args list="true">
    <arg>
      <key>method</key>
      <value>facebook.friends.get</value>
    </arg>
    <arg>
      <key>session_key</key>
      <value>373443c857fcda2e410e349c-i7nF4PqX4IW4.</value>
    </arg>
    <arg>
      <key>api_key</key>
      <value>0289b21f46b2ee642d5c42145df5489f</value>
    </arg>
    <arg>
      <key>call_id</key>
      <value>1170813376.3544</value>
    </arg>
    <arg>
      <key>v</key>
      <value>1.0</value>
    </arg>
    <arg>
      <key>sig</key>
      <value>570dcc2b764578af350ea1e1622349a0</value>
    </arg>
  </request_args>
</error_response>

[edit] Error code table

Error number PHP Constant name Error description Generated by methods
1 API_EC_UNKNOWN An unknown error occurred (all)
2 API_EC_SERVICE Service temporarily unavailable (all)
3 API_EC_METHOD Unknown method
4 API_EC_TOO_MANY_CALLS Application request limit reached (all)
5 API_EC_BAD_IP Unauthorized source IP address (all)
6 API_EC_HOST_API This method must run on api.facebook.com (all)
100 API_EC_PARAM Invalid parameter (all)
101 Invalid API key (all)
102 Session key invalid or no longer valid (all)
104 Incorrect signature (all)
110 API_EC_PARAM_USER_ID Invalid user id photos.addTag
120 API_EC_PARAM_ALBUM_ID Invalid album id
121 API_EC_PARAM_PHOTO_ID Invalid photo id
130 API_EC_PARAM_FEED_PRIORITY Invalid feed publication priority
200 API_EC_PERMISSION Permissions error
240 API_EC_PERMISSION_MARKUP_OTHER_USER Desktop applications cannot set FBML for other users
250 API_EC_PERMISSION_STATUS_UPDATE Updating status requires the extended permission status_update. users.setStatus
260 API_EC_PERMISSION_PHOTO_UPLOAD Modifying existing photos requires the extended permission photo_upload photos.upload, photos.addTag
321 API_EC_EDIT_ALBUM_SIZE Album is full
322 API_EC_EDIT_PHOTO_TAG_SUBJECT Invalid photo tag subject
323 API_EC_EDIT_PHOTO_TAG_PHOTO Cannot tag photo already visible on Facebook
324 API_EC_EDIT_PHOTO_FILE Missing or invalid image file
325 API_EC_EDIT_PHOTO_PENDING_LIMIT Too many unapproved photos pending
326 API_EC_EDIT_PHOTO_TAG_LIMIT Too many photo tags pending
330 API_EC_EDIT_MARKUP Failed to set markup
340 API_EC_EDIT_FEED_TOO_MANY_USER_CALLS Feed publication request limit reached
341 API_EC_EDIT_FEED_TOO_MANY_USER_ACTION_CALLS Feed action request limit reached
342 API_EC_EDIT_FEED_TITLE_LINK Feed story title can have at most one href anchor
343 API_EC_EDIT_FEED_TITLE_LENGTH Feed story title is too long
344 API_EC_EDIT_FEED_TITLE_NAME Feed story title can have at most one fb:userlink and must be of the user whose action is being reported
345 API_EC_EDIT_FEED_TITLE_BLANK Feed story title rendered as blank
346 API_EC_EDIT_FEED_BODY_LENGTH Feed story body is too long
347 API_EC_EDIT_FEED_PHOTO_SRC Feed story photo could not be accessed or proxied
348 API_EC_EDIT_FEED_PHOTO_LINK Feed story photo link invalid
600 FQL_EC_UNKNOWN_ERROR An unknown error occurred in FQL
601 FQL_EC_PARSER_ERROR Error while parsing FQL statement
602 FQL_EC_UNKNOWN_FIELD The field you requested does not exist
603 FQL_EC_UNKNOWN_TABLE The table you requested does not exist
604 FQL_EC_NO_INDEX Your statement is not indexable
605 FQL_EC_UNKNOWN_FUNCTION The function you called down not exist
606 FQL_EC_INVALID_PARAM Wrong number of arguments passed into the function
700 API_REF_SET_FAILED Unknown failure in storing ref data. Please try again.
950 API_BATCH_TOO_MANY_CALLS Each batch API can not contain more than 20 items
Navigation