GetTags Method - FacebookInvalidFqlSyntaxException

Dec 1, 2007 at 9:53 PM
Anyone else getting:

'FacebookInvalidFqlSyntaxException' when calling the FaceBookService.GetTags method?

The code I'm using to call this method is as follows:

Collection<PhotoTag> Tags = _fbService.GetTags(FriendsPhotoId);

Where 'FriendsPhotoId' is a Collection<string> of photoIds.

I have listed the more complete error code below. Any help would be greatly appreciated.


My full error is as follows: (note: 3137946751915379097 is the first photoId in the list of PhotoId's.

Facebook.Exceptions.FacebookInvalidFqlSyntaxException was unhandled by user code
Message="Parser error: unexpected 'IN3137946751915379097' at position 61."
at Facebook.API.FacebookAPI.ErrorCheck(XmlDocument doc)
at Facebook.API.FacebookAPI.LoadXMLDocument(String rawXML)
at Facebook.API.FacebookAPI.GetTags(Collection`1 photoList)
Dec 2, 2007 at 12:02 AM


been playing around a little more. It appears that the Developer Toolkit is NOT converting into valid SQL(or FQL).

I have made the following adjustment to my code:

FriendsPhotoId.Add(" " + FriendsPhotos10.PhotoId);
Collection<PhotoTag> MyTags = _fbService.GetTags(FriendsPhotoId);

By adding the space ie " ", the method works and brings back an Object of type <PhotoTag>. So error 1 appears that the GetTags method is not adding a space between the SQL 'IN' word, and the provided PhotoId. (see the error in my first mail ie 'IN3137946751915379097').

Secondly, when I uncomment my second line and allow 2 Photo IDs into my array, I get an error indicating that there is an unexpected "," (comma) in the SQL code. If I can't put in an array into this Method then it effectively becomes useless and I have to ask for tags one Photo at a time.

Is there anyone out there dedicated to bug fixes? Or alternatively maybe someone can point out where I am going wrong.

Jan 7, 2008 at 4:00 PM
I'm having the same problem, can't receive tags.
anyone solved it?
Mar 25, 2008 at 6:38 PM
I ran into this as well and created an issue for it:
Jun 19, 2008 at 11:50 PM
I found a fix, If you open FacebookAPI.cs and go to line 988: replace the line starting "parameterList.Add(.." with this:

String.Format(CultureInfo.InvariantCulture, "{0}{1}",
"SELECT pid, subject, xcoord, ycoord FROM photo_tag WHERE pid IN (",
StringHelper.ConvertToCommaSeparated(photoList) + ")"));

That solved all issues over here and now it works fine!

What I've done is add a space after "IN" which was noticed first in the posts above, then i've added "(" and ")" brackets into the query which makes it pass as valid FQL on the server side!

If you can't edit the Facebook.API file in the source, or don't have access you might want to try adding " )" to the first item in the photolist, and ")" to the last. That  should also do the trick i think.

FQL Explorer which is a facebook web app was used to help me debug it and realise what was going on, so might be worth a look if you're wanting some testing of your FQL queries etc before coding them!