New page with Panels variation.
Context - logged in user
Relationship - Node from User (on node.node_author)

Notice: Undefined index: relationship_entity_from_schema:uid-user-node_1 in theme_ctools_context_list() (line 233 of /Applications/MAMP/htdocs/mysite/sites/all/modules/ctools/includes/

Now here is the thing, if I have a node with a nid that matches my uid (If I'm logged in as user 1, and a node 1 exists) there is no error. But if I delete node 1, and create node 2 (authored by uid 1), I see an error, and the list of fields at the bottom does not display.

It seems to be trying to load a node, not by author at all, but by matching id... which is quite puzzling. Can anyone else give me some insight here?

After extensive debugging, I see the problem appear in ctools_context_create_entity(). In line 81 of it has:
$data = entity_load($entity_type, array($id));
Now, debugging these vars shows me that $entity type is 'node' and $id is the ID of the user that our relationship is based on... so we are trying to load a node by passing it a uid??

P.S. I'm only using nodes to explore and explain this issue - my real use case is an eck entity which is having exactly the same issues...



If I hack this line in:
if($entity_type == 'node'){ $id = 2; }
The error disappears and I can see the fields...

Several other people have noticed similar problems, and I've put notes on them that they're duplicates of this issue.

So the problem here is that in, the function theme_ctools_context_list() is trying to build the Relationships section of the contexts list, around line 230:

      if (isset($relationship['keyword'])) {
        $desc .= '<div class="description">' . t('Keyword: %@keyword', array('@keyword' => $relationship['keyword']));
        foreach (ctools_context_get_converters('%' . $relationship['keyword'] . ':', $contexts[ctools_context_id($relationship, 'relationship')]) as $keyword => $title) {
          $desc .= '<br />' . t('@keyword --&gt; @title', array('@keyword' => $keyword, '@title' => $title));
        $desc .= '</div>';
      $output .= '<td>' . $desc . '</td>';
      $output .= '</tr>';
      $titles[ctools_context_id($relationship, 'relationship')] = $relationship['identifier'];

The problem is that there is an assumption that $contexts and $titles both have an entry corresponding to ctools_context_id($relationship, 'relationship'). But they don't. I don't think the relationships are making entries in $context at all actually. [Some of the reported errors from other issues are in the $contexts array and some are in the $titles array, but I think it's really the same problem]

I just ran into it with a custom plugin I am trying to write, and others have run into it with other types of plugins... I'm not sure I understand the code well enough to fix it though?

bumb? This is important

Version:7.x-1.x-dev» 7.x-1.3

Version:7.x-1.3» 7.x-1.x-dev

Do not change the version please. Yes the issue exists in 7.x-1.3, but it needs to be fixed in the development version.

bumb? Can anyone help here? Important!

Priority:Major» Critical

We just ran into this issue again, and this time using a Relationship plugin provided by CTools.

The plugin is the generic "entity from schema" relationship plugin, and in this case, it was the "reverse" relationship that tries to find a Commerce Order from a User.

The error message this time is:
Notice: Undefined index: relationship_entity_from_schema:uid-user-commerce_order_1 in theme_ctools_context_list() (line 230 of /opt/www/deohs/sites/all/modules/contrib/ctools/includes/

Also, in this case after adding the relationship, it doesn't appear to work -- it doesn't show up, for instance, when I try to base a Selection Rule for a Panels Page on this relationship (for instance, using the "context exists" condition). That may be a separate issue, but then again it may not be.

Sorry I haven't been able to help. The client reconfigured their requirements so I don't need Panels anymore...

I'm experiencing the same issues described above except with a entity_from_field relationship provided by CTools. The use case is adding a context to capture an OG a user belongs to based on the og_user_node field on the user entity, but if the relationship is based off of the logged in user and the logged in user doesn't belong to a group then the call to ctools_entity_from_field_context() fails and doesn't load the context for the relationship. With this relationship context missing theme_ctools_context_list() fails resulting in the error below.

Notice: Undefined index: relationship_entity_from_field:og_user_node-user-node_1 in theme_ctools_context_list()

This instance of the error traces down to this block inside of ctools_entity_from_field_context():

if (isset($context->data->{$entity_info['entity keys']['id']})) {
// Load the entity.
$id = $context->data->{$entity_info['entity keys']['id']};
$entity = entity_load($from_entity, array($id));
$entity = $entity[$id];
    if (
$items = field_get_items($from_entity, $entity, $field_name)) {
      if (isset(
$items[$delta])) {
$to_entity_info = entity_get_info($to_entity);
$plugin_info = ctools_get_relationship($conf['name']);
$to_entity_id = $items[$delta][$plugin_info['source key']];
// Send it to ctools.
return ctools_context_create('entity:' . $to_entity, $to_entity_id);
      else {
// In case that delta was empty.
return ctools_context_create_empty('entity:' . $to_entity, NULL);

In the above code, the call to field_get_items() returns empty and fails the conditional which drops out of the function without any explicit return value. I'm not familiar enough with this code to know the ramifications of changing this section, but my initial thought is that the conditional should be adjusted such that an empty context is returned if no field items are found.

This instance of the error relates somewhat tangentially to the originally reported issue, but I expect this and the other related issues stem from similar logic throughout the context plugins.

still getting the errors after applying the patch

I don't expect the patch posted in #10 to fix the issue, but rather serve as an example of the logic that may be the cause. That patch fixed the specific issue I was having and I expect similar fixes would be applicable in multiple places throughout CTools to address this and the other related issues.


Issue summary:View changes

I have a very similar issue.

I am trying to use a views content pane with a contextual filter based on a field from the user. It fails with a similar error message:

Notice: Undefined index: relationship_entity_from_field:field_diocese_reference-user-node_1 in theme_ctools_context_list() (line 230 of .../sites/all/modules/ctools/includes/

new546 bytes

I have the same error as #10 and here is a patch for (today) latest ctools.