Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Upon upgrade to new version:
Unexpected term id 32 associated with [node-title]. Please report this to https://drupal.org/node/1918272.
Happens with valid term id's.
Comments
Comment #1
StephenRobinson CreditAttribution: StephenRobinson commentedThis happens with anonymous users, I have debugged and cannot reproduce:
scaringly when this happens, no access denied occurrs so the access control fails....
Comment #2
Dave Cohen CreditAttribution: Dave Cohen commented"This happens with anonymous users," makes me think you can reproduce the problem, while "I have debugged and cannot reproduce" makes me think you can't. Which is it?
The node(s) where this happens, are they tagged with term id 32? How are they tagged? Via a regular term reference field or some other way?
Comment #3
StephenRobinson CreditAttribution: StephenRobinson commentedI have added some debug statements and the tid's array is an empty array when this happens, which is not every time, very strange
results
Comment #4
StephenRobinson CreditAttribution: StephenRobinson commentedI am using a term reference from /admin/structure/types/manage/campus_event/fields
Comment #5
StephenRobinson CreditAttribution: StephenRobinson commentedflakey database API?
Comment #6
StephenRobinson CreditAttribution: StephenRobinson commentedThe plot thickens, I think this happens when cron is sending content to apachesolr
Comment #7
StephenRobinson CreditAttribution: StephenRobinson commentedcorrect data, from another debug statement:
Comment #8
StephenRobinson CreditAttribution: StephenRobinson commenteddoes not happen if you index data as a logged in admin user
Comment #9
StephenRobinson CreditAttribution: StephenRobinson commentedtac_lite_node_get_terms is missing a return value when cron runs
Comment #10
StephenRobinson CreditAttribution: StephenRobinson commentedI think this has to do with node_load not having the term id for anonymous, as this is used in tac_lite_node_get_terms, I have a scheme for Visibility and Visibility on create and edit forms, I have allowed this term for anon, so it shows up when you view nodes as anon, so therefore is available upon node_load for anon, so this should have fixed the issue, didn't throw errors with previous versions, but looks like it was a configuration issue, so this may have fixed the issue, will find out on tomorrows cron?
Thanks for the time,
Stephen :)
Comment #11
Dave Cohen CreditAttribution: Dave Cohen commentedA little history might help understand what's going on.
In Drupal 7.x, tac_lite has no clean reliable way to get the terms associated with a node. In previous versions of drupal there was simply a table with term ids and node ids. Now with fields and entities, that simple table got lost and nothing replaced it.
So tac_lite for D7 used the taxonomy_index table for this purpose. Until not too long ago someone pointed out that table is only maintained for published nodes. Unpublished nodes appeared to have no terms associated with them, to tac_lite.
In reponse to that, I added some code that inspects fields, specifically term reference fields, and use that to build the list of terms associated with a node. This approach works for both published and unpublished nodes. However, I was never 100% confident in the new code, so I left the old code intact, and when the term list derived by the new code fails to find a term derived by the original code, you see that warning.
The good news is that when the warning appears, tac_lite does treat the node as tagged with the term. This is, I think, the right thing to do. however it would not honor this term if the node is unpublished. Possibly a problem there, although I doubt the cron job acts on unpublished nodes.
My question is, why is this code being called during cron jobs? I don't think it is simply building the search index, because the code is rebuilding the node access table, which happens when nodes are saved. I'd be interested in seeing a stack trace. That might point out the root cause.
Comment #12
Dave Cohen CreditAttribution: Dave Cohen commentedThere is a setting in tac_lite for term visibility. Make the terms (as opposed to the nodes tagged with them) visible to everyone should make this problem go away.