[SalesForce] Why would this Chatter REST Api Http POST return a 500 Server Error

I'm using C#.Net to (upload) POST a new User Photo to Salesforce.

Using Fiddler I'm able to monitor the HTTP activity to and from my computer.

Here's the raw data I'm sending in the POST (with parts in brackets excluded):

POST https://cs7.salesforce.com/services/data/v26.0/chatter/users/[my User Id]/photo HTTP/1.1
Authorization: OAuth [my Salesforce Session Id]
Content-Type: multipart/form-data; boundary=8cfa2a52b1be413
Host: cs7.salesforce.com
Content-Length: 15054
Expect: 100-continue

--8cfa2a52b1be413
Content-Disposition: form-data; name="xml"
Content-Type: application/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit

<photo></photo>
--8cfa2a52b1be413
Content-Disposition: form-data; name="fileUpload"
Content-Type: application/octet-stream; charset=ISO-8859-1
Content-Transfer-Encoding: binary

[binary data for a jpg file]
--8cfa2a52b1be413--

However, I'm receiving this error back from Salesforce:

HTTP/1.1 500 Server Error
Date: Fri, 07 Dec 2012 21:17:58 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked

9C
[{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 160445444-13550 (94877017)","errorCode":"UNKNOWN_EXCEPTION"}]
0

Does anyone know what would cause this?

Best Answer

Thoughts: Looking at the documentation you appear to be doing the correct thing here, and as per below this is an unexpected exception from the platform. So other than following the support route (which would not harm), we are on our own. So its time to experiment, apologies if you have tried some of these, but maybe some will spark another avenue...

  • Have you tried it with the /user/me/photo?
  • Have you tried it with a different image format?
  • Have you confirmed the content of the tag is valid?
  • What happens if you don't send the image data? Does it give another error that is meaningful? Perhaps relates to some other issue the unhandled one is masking?
  • Does it work if you do it via the UI?
  • Can you find another app that does this and use Fiddler to review its HTTP messages?
  • Have you tried it in a Developer Org as apposed to your Sandbox?

Salesforce Internal Error Codes: What your receiving is an unhandled / unexpected exception from Salesforce. Only Salesforce support can decode internally the error message behind it and hopefully give you a clue as to what might be going wrong to cause this. As its unhandled / unexpected its likely you've found a bug of some kind. However its also likely the correct passing of information can be found once more is known, as I suspect this a issue in the API's internal validation code. As the message says I would contact Salesforce support and provide them with the codes.

Please include this ErrorId if you contact support: 160445444-13550 (94877017)