"An HTTP error 200 occurred." when trying to flag a node in a Views table
Matt V. - April 13, 2009 - 01:20
| Project: | Flag |
| Version: | 6.x-1.1 |
| Component: | Views integration |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Description
I have a table view with an flag link for each node. When I try clicking on one of the links, I get a javascript pop-up with an error message that says "An HTTP error 200 occurred..." followed by a long URL that ends in a &token= value.

#1
I'm experiencing the same error using IE 8 when trying to flag content. Any ideas anyone?
#2
When "An HTTP error 200 occurred..." shows up it usually because of some PHP error on your site. (One other possible reason: doing a page redirection upon flagging.)
To see the actual PHP error, open the link in a new window (or tab).
In other words:
Don't click the flag link with your left mouse button. Instead, click it with your right mouse button. Then, using the context menu, open the link in a new tab/window. The page you'll see will probably reveal something about why the error occurred. Please report back the result.
#3
It looks like it might be a Views issue:
#4
Note that the 'fid' on the right side of the "=" is missing. This could happen if the flag doesn't exist.[1]
Examine the view. (Go to its editing screen.) Inspect all the flags names you see there (e.g. "bookmarks", "friends"; in the relationships), and make sure you haven't deleted any of them. It's certainly possible to have a view that reference flags that no longer exist ...this would generate the faulty SQL you saw.
-----
[1] But, then, taking $flag->fid would trigger a PHP warning ("Trying to get property of non-object")... it's interesting that you didn't report this. Maybe because the "official" Drupal doesn't alert of these warnings. I suggest you have a look in your watchdog log.
#5
I only have one flag field under the relationships section. I tried removing it, but that breaks the view. When I added it back in, I still received the error message in comment #3.
I tried deleting the bookmark flag that I think comes bundled with the flag module, just in case, and I still got the error. I also tried removing the exposed filter I had set up for the flag, and I still got the error.
On the off chance that it might help, I've exported the view and I'm attaching it here.
#6
I opened a new tab as suggested, but it appears the flag went through ok with no mysql errors. However, when I try to just click on the flag link in the same window I get the HTTP error 200 message. You mentioned the problem could be a redirection issue. My link is looking like this:
http://192.168.1.100/drupal4/flag/flag/plus_favorite/270?destination=nod...
Could there be a problem in my links?
In FF, the flags work :( .
#7
For what it is worth, I have seen this issue (the error in views join) when I have a relationship to a flag that does not exist, or exists with a different name. The views relationship looks up flags by name. One way to figure out what is happening is to export the view and look at which flag name it is trying to join and verify that flag exists and is enabled.
Good luck.
#8
Perhaps yours is a jQuery issue. Could you upgrade your jQuery and report back? (Use the '-dev' version of jquery_update, because its jquery is newer.)
#9
@Matt,
#10
I am also getting similiar behavior from my site when I try to add a "Flagged Link" field in a table view. I'm using firefox, and and it throws an error when i click on add. the error is "An error occurred at http://192.168.1.34/admin/build/views/ajax/add-item/requests_marketing/default/field."
If i copy that link into my browser and try to access it, i get a return with no errors. Also, if i refresh the page, it ads the field to my lists of fields. but the field isnt actually displaying anything in the table.
I would lean against this being an issue with a missing flag, as I only have 1.
#11
I found my problem...if its related. This appears to be a bug in views. I was able to fix mine by upgrading to 6.x-2-dev
#12
Cangeceiro, thank you for the report.
Once somebody corroborates this we should put this info on Flag's homepage.
#13
I just tried upgrading to Views 6.x-2-dev and it didn't fix the problem for me. I'm going to try recreating the view from scratch when I get a little more time. I'll report back.
#14
#15
Not sure if this is related, but when try to put a flag link into a node view where I'm using node id as an argument, the SQL includes a field 'users.nid', which throws a SQL error because users has no nid field.
#16
strangely this problem came back for me. but in a slightly different form. after upgrading to the dev version of views it worked for a day, and just this morning i started getting "Fatal error: Call to a member function get_views_info()" I have opened an issue on the views project at http://drupal.org/node/450690
#17
In response to #8:
Jquery update with -dev version introduced other issues for me. ie broke ajax comments and broke fivestar module. I did notice that flags were going through, but without ajax animations. I'll keep investigating.
#18
Marking this 'critical'.
As for the "HTTP error 200" alert box: It's a mystery because I don't see why any Views code gets called when one just clicks an ajaxy flag link.
#19
Hey... perhaps Views erroneously attaches a Javascript click-handler to Flag's links when the view's AJAX support is turned on? I see that Views does
.find('ul.pager > li > a, th.views-field a, .views-summary a')so Views is not supposed to pick up our links, but who knows. I can't check things further as I'm not running Drupal.Could anybody turn off the view's AJAX support and see if it solves the "HTTP error 200" alert box problem?
#20
mooffie,
If you mean the "Use AJAX" option under the "Basic settings" section of the view, that was already turned off for the view I've been having trouble with. Just to be thorough, I tried turning off Javascript using the Web Developer Toolbar for Firefox and I still got the error message.
#21
merlinofchaos said in #450690: Fatal error: Call to a member function get_views_info() mentioned in #16:
Agreed, this is critical:
$ grep -lir "get_views_info" *flag.incincludes/flag_handler_field_ops.inc
includes/flag_handler_argument_content_id.inc
includes/flag.views.inc
$
#22
I also have this issue as described in #16. Any luck on solving it?
#23
Regarding #16, I found that when I had my flag configured to use multiple content types, I got the fatal error. When I removed the second content type, everything worked as expected.
#24
I found solution :)
Its simple. U have to enable that flag u use in views. I mentioned it here: http://drupal.org/node/450690#comment-1796822
#25
I've never been able to reproduce this bug, but the solution posted by boreg in #24 sounds likely to be a fix. Sounds like a problem with flag_friend specifically creating a default view and a default flag that is disabled. Since a new version of Flag Friend has since been released, that might explain why the bug reports slowed or stopped. Unless there is some confirmation that boreg's solution does not fix the problem, I think we can close this issue.
#26
Closing after lack of response.
#27
I've updated to the latest version of Views (6.x-1.8) and I'm still getting essentially the same error as in #3. In comment #24 above, is that referring to the "What nodes this flag may be used on" setting for the flag? If so, I have that set.
Can anyone help me pinpoint where the right-hand side of the "flag_content_users.fid =" argument gets set?
#28
Matt V: Could you provide steps to reproduce this issue, or post an export that is very, very simplistic? The export you posted above seems complicated to reproduce, needing VotingAPI and custom node types and flags. It'd help to be able to easily reproduce this problem, as it is I'm not sure how to fix something I can't see.
#29
quicksketch,
Thanks for the quick response. Here is a simplified example that still exhibits the issue.