enabled metatag module, & goto add content page it shows below error..
The Page title is using the following invalid tokens: [node:title], [site:name].
The Description is using the following invalid tokens: [node:summary].
The Canonical URL is using the following invalid tokens: [current-page:url:absolute].
The Shortlink URL is using the following invalid tokens: [current-page:url:unaliased].

thanks in advance,

Comments

DamienMcKenna’s picture

Priority: Critical » Normal

Had you used a previous version? Do you have the latest Token module?

Nikhil Banait’s picture

Run cron manually and clear the performance cache.

swishstar’s picture

I had a similar issue. However, I had "another error" that was happening prior to my save and once I cleared that up, then this one went away. So be sure to clear all errors that appear on "other pages" first. In my case, I had a pass-by-reference that Drupal didn't like that probably didn't allow the Token module to load properly.

DamienMcKenna’s picture

Component: User interface » Other tags
Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)

Need more details.

crutch’s picture

I experienced this error after completing upgrade d6>d7. Flushed cache and all that.

Default is still not accepting tokens. If when you manually enter something in Default, like the site name, then the page saves and tokens are able to be used for all the other fields.

I'm just beginning reconfig of site and theme. If using admin toolbar, just begin running through the list of items under the "Configuration" menu item and when reaching Page Title, is when the issue happens.

BenWrighton’s picture

#2 worked for me on D7.

EgbertB’s picture

#2 also worked for me in d.7.22

chaz1975’s picture

I tried running Cron followed by clearing cache but that didn't work.

In the end I reloaded the same version of the Token module and that seemed to do the trick.

I'm using Drush so the command is drush dl token-[version].

david_garcia’s picture

This problem happens if the token_info cache gets corrupted or is incomplete, in those cases even some token provided by core are not loaded.

I am trying to isolate a reproducible case in which this happens consistently, because a core cache get corrupted first (hook_info) preventing modules exposing tokens in module.tokens.inc files to have their tokens recognized (including core tokens exposed by the system or the node module) this ultimately leads to the failure in the original report.

#2457269: Incomplete hook_info cached if there's an error/warning during module_load_all

askibinski’s picture

So this suddenly appeared on a site to me too... Running cron and flushing all caches (also manually) does not help.

- Drupal core 7.35
- Token 1.4
- Metatags 1.4

I guess I can try to upgrade token to 1.6.

askibinski’s picture

Upgrading to token 1.6 and a drush rr did seem to fix it in this case.

brooke_heaton’s picture

#11 worked for me.

DamienMcKenna’s picture

Status: Postponed (maintainer needs more info) » Fixed

Metatag currently requires Token module v1.6, so I think this should be a-ok now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

numbtongue’s picture

Not sure of the side effects but for my case I was able to fix it by disabling metatag for node->Content type on this page yourdomain.com/admin/config/search/metatags

parvind87’s picture

Running cron and subsequently clearing the cache fixes the problem
I am using drush so following commands need to run -
drush cron
drush cache-clear all

semitruckrepair’s picture

I try everything you guys recommended above but i still can't post i'm getting this error code

The hreflang value for English (English) is using the following invalid tokens: [node:url-en].

any help what i should do this is new site just start the development and i'm stuck
other provlem feed importer module it want let me see the choose file button
any suggestion help will be great thanks

DamienMcKenna’s picture

@semitruckrepair: Please create a new issue and I'll be happy to look into it with you. Thanks.

Samba B’s picture

#2 worked for me. Thanks!! I have been replacing the metatag.tokens.inc to resolve this. Thanks again for making me realize that I am doing wrong.

leisurman’s picture

For me I get
The Block title is using the following invalid tokens: [node:field-sidebar-title].

I am using token 7.x-1.6
Media7.x-1.5
File entity 7.x-1.5

When I run cron I get error
EntityMalformedException: Missing bundle property on entity of type node. in [error]
entity_extract_ids() (line 7880 of /var/www/html/upgrade2a/includes/common.inc).

There is Schema mismatch in my file_entity table

jas.yayas’s picture

Guys

I just disabled Metatag: hreflang (metatag_hreflang) module and issue resolved.

Dont forget to clear the cache and run cron

prabhjotg’s picture

#2 worked for me.

Mykola Dolynskyi’s picture

Metatag 7.x-1.20 + Core 7.50 - clearing chache dont help, problem remains

DamienMcKenna’s picture

@Mykola: Make sure you have the latest release of Token, otherwise please explain which token it is complaining about.

Mykola Dolynskyi’s picture

@DamienMcKenna it complains on site:name, node:title, current-page:pager, node:summary
Tokens are 1.6, updating to 1.7 now

DamienMcKenna’s picture

@Mykola: What form are you entering those tokens - a node form, a metatag settings form?

Mykola Dolynskyi’s picture

@DamienMcKenna updated.
Cleared cache, flushed caches , runned cron ... no luck

Mykola Dolynskyi’s picture

FileSize
137.49 KB

@DamienMcKenna this
node form, populated automatically from somewhere
I never was entering values for metadata

Mykola Dolynskyi’s picture

FileSize
420.83 KB

Here is how Metatag config page looks like cfg page
Unknown, Unknown, Unknown everywhere about type

Remark says "Any items marked "Unknown" are configurations in the system for entity types or bundles which have been disabled via the API or the Settings page; they will not be used."
But they are enabled.
When try to add new default metatag in config form type list select dropdown is empty (only has "Select type") value ( /admin/config/search/metatags/config/add link )

Mykola Dolynskyi’s picture

Clearing the cahce directly from Metatag Cfg page ( admin/config/search/metatags ) - helped
But i think it is not for long. This thing started to come from Saturnday and managed this it with weired combinations which i dont remember, it was 2 times. Now it is third time
Sure i have checked reports - nothing suspective there

DamienMcKenna’s picture

@Mykola: There's something else interfering with the module, which is why it isn't working properly, you can tell this by the fact on the defaults page it says "Unknown" instead of the entity labels.

What does your settings page look like?

Mykola Dolynskyi’s picture

@Damien admin/config/search/metatags/settings page is too big for single screenshot.
As i said clearing the cache directly from admin/config/search/metatags/page - is only way to resurect proper work.
I never changed anything in metatags for 1.5 years, didnot updated anything for few months - this problem just raised without any visible reason.
If I clean cache from anywhere - the problem is back.
If from module cfg page - it is gone (works again).
I will debug/investigate how it happens later - have to move other tasks now.
My suggestion - some bad thing in Entity API happens

DamienMcKenna’s picture

@Mykola: The main thing I'm wondering about on the settings page is the "Master control for all entities" section, what does that look like?

Mykola Dolynskyi’s picture

FileSize
374.14 KB

i warned you - it is big :)
big

DamienMcKenna’s picture

Version: 7.x-1.0-beta7 » 7.x-1.x-dev
Status: Closed (fixed) » Active

@Mykola: Do you see any errors when you clear the site's caches? #2457269: Incomplete hook_info cached if there's an error/warning during module_load_all might be related.

Mykola Dolynskyi’s picture

@Damien no, no erros in drupal_set_message() no errors in watchdog (in watchdog are, but they are about my modules about forms)

I stated digging - metatag config is loaded with ctools_export_crud_load_all (in metatag_config_overview())
But where damn they are saved?
metatag_config_save() is used in form for manual adding and few addons which is not related to what i expected to find.
I expect code something like when you clear cache - there entities are iterated, tokens resolved and saved to metatag config. metatag_config_save() dont lead me to anything like this. I will try to find by something like drupal_write_record(...) - if i will find nothing i will try to update Drupal core to latest (current 7.50)

Thanks for link about Bootstrap invoking order, will check this also.

Mykola Dolynskyi’s picture

FileSize
688.17 KB

dont know if this realted to problem, but ... ?
updated core, checking results

UPD: after core updated to 7.54 - problem remains

Mykola Dolynskyi’s picture

and Rules module started to fail out with

Fatal error: Call to undefined function entity_token_tokens() in /var/www/extranet/sites/all/modules/rules/rules.module on line 1670

Rules issue solved this way

DamienMcKenna’s picture

Oh wow, that screenshot shows that the system tokens are unavailable system-wide, something is really messed up with your system!

Can you please give me a list of the hooks you're using in your custom modules, maybe one of them is doing something it shouldn't be? Also, a list of the contrib modules you're using would help, I'll download them all locally so I can review them too.

Mykola Dolynskyi’s picture

@DamienMcKenna i have > 20 000 lines in total of custom modules (client has some documentory workflow with drupal)
They are not spagetti code but to much.
What makes me confused - this all started suddenly, not after update or some "controller-close" changes, was working for months with no problems.
What i do with tokens is for example custom solver function which i call directly in custom content type save handler (hook_node_save())

function appraisal_v2_system_token_map_type($type) {
  $entity_info = entity_get_info();
  if (isset($entity_info[$type]['token type'])) {
    return $entity_info[$type]['token type'];
  }
  $cache = rules_get_cache();
  if (isset($cache['data_info'][$type]['token type'])) {
    return $cache['data_info'][$type]['token type'];
  }
  return $type;
}

function appraisal_v2_evaluate_token($text, $options, $tokenvalues, $tokentypes) {
  $options += array('sanitize' => FALSE);

  global $user;
  $olduser = clone $user;
  $user = user_load(994);
          
  $replacements = array();
  $data = array();
  // We also support replacing tokens in a list of textual values.
  $whole_text = is_array($text) ? implode('', $text) : $text;
  foreach (token_scan($whole_text) as $var_name => $tokens) {
    $var_name = str_replace('-', '_', $var_name);
    if (!empty($tokentypes[$var_name]) && !empty($tokenvalues[$var_name])) {
      $tt = appraisal_v2_system_token_map_type($tokentypes[$var_name]);
      $replacements += token_generate($tt, $tokens, array($tt => $tokenvalues[$var_name]), $options);
    }
    else {
      $replacements += token_generate($var_name, $tokens, array(), $options);
    }
    // Remove tokens if no replacement value is found. As token_replace() does
    // if 'clear' is set.
    $replacements += array_fill_keys($tokens, '');
  }

  // Optionally clean the list of replacement values.
  if (!empty($options['callback']) && function_exists($options['callback'])) {
    $function = $options['callback'];
    $function($replacements, $data, $options);
  }
  
  $user = $olduser;

  // Actually apply the replacements.
  $tokens = array_keys($replacements);
  $values = array_values($replacements);
  if (is_array($text)) {
    foreach ($text as $i => $text_item) {
      $text[$i] = str_replace($tokens, $values, $text_item);
    }
    return $text;
  }
  return str_replace($tokens, $values, $text);
}

call (from appraisal_v2_node_save())

            $subject = variable_get('appraisal_v2_'.$newstatus.'_subject', '');
            $body = variable_get('appraisal_v2_'.$newstatus.'_body', '');
            
            $tokens = array('appraisal'=>$node, 
                'reciver'=>$reciver, 
                'employee'=>$employee, 
                'manager'=>$manager,
                'status'=>$newstatus,
                'prevstatus'=>$status,
                'mailsubject'=>$subject,
                'mailbody'=>$body,
                'usermsg'=>$usermsg);
            
            $tokentypes = array('appraisal'=>'node', 
                'reciver'=>'user', 
                'employee'=>'user', 
                'manager'=>'user',
                'status'=>'text',
                'prevstatus'=>'text',
                'mailsubject'=>'text',
                'mailbody'=>'text',
                'usermsg'=>'text');

            $options = array();
            $subject = appraisal_v2_evaluate_token($subject, $options, $tokens, $tokentypes);
            $body = appraisal_v2_evaluate_token($body, $options, $tokens, $tokentypes);
        
            watchdog('Appraisal v2', "Invoking new status mail sending to " . format_username($reciver));
            rules_invoke_event('appraisal_v2_new_status', $employee, $manager, $reciver, $newstatus, $status, $node, $subject, $body, $usermsg);
            drupal_set_message("Appraisal '" . $node->title ."' successfully pushed to status " .$status_names[$newstatus] .".
" . "Notification is send to user " . theme('username', array('account' => $reciver)) . "" );
Mykola Dolynskyi’s picture

FileSize
527.27 KB

if i do kint(token_info()) on site with problems i have very few tokens
t
if on site which works file - plenty of tokens, for each field, for title, author ... everything

Mykola Dolynskyi’s picture

dpm(module_implements('token_info_alter'));

comparing to site which is ok site with problems such module implementation if hook_token_info_alter ae missing: entity_token, field_collection, file_entity ...

Mykola Dolynskyi’s picture

Reinstalling token and entity_token modules helped (used Devel tool /devel/reinstall)
Sorry for bothering, this was not related to metatag module, but may be this all posts will help somebody, who knows.
Happy end :)

smaiau’s picture

Hey Mykola,
I have the same issue for my website, reinstalling token and entity_token resolved the problem for you ?

Thanks for your reply,