Hello,

I am running token 7.x 1.0 beta 7, but there are no tokens available.
See attached screenshot about which tokens are available. But for example no node anything, while I would like to use [node:title].

The thing is I cannot reproduce it. It is just not available on this site, but not on any other.

CommentFileSizeAuthor
#5 failed-test.png89.75 KBNoe_
#2 new_errors.jpg101.05 KBNoe_
available_tokens.jpg22.11 KBNoe_
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Category: bug » support

Maybe you might need to clear your site's cache. Which module is displaying this list of tokens?

Noe_’s picture

FileSize
101.05 KB

I just know which module provides the google analytics tokenizer tokens, that is the google analytics tokenizer module.
By the way, I uninstalled that module.

I did clear the cache and that resulted in errors, see attached screenshot.

And in case you were wondering I still don't have the node:title
Isn't that (node:title) provided by the token module?

Dave Reid’s picture

For the new errors, it sounds like a module isn't providing the right data in hook_token_info(). You may be able to check the admin/reports/status to check which tokens are the problem.

Noe_’s picture

Hey that's it !!

The following token types are not defined but have tokens:
$info['types']['node']
$info['types']['term']
$info['types']['vocabulary']
$info['types']['file']
$info['types']['user']
$info['types']['current-user']

But now for the inevitable question: What to do now?

Could you point me in the right direction?

Noe_’s picture

FileSize
89.75 KB

Ok this is what I found so far:

Correct me if I am wrong.
Well you probably know that all of the above tokens are generated by the token module.
So I downloaded the latest dev version of token to see if the problems there still exist, they do.

Then I enabled the testing module, and tested the token module.
There are two failed tests as you can see in the screenshot.

Dave Reid’s picture

That's very odd. There's no reason that those token types shouldn't be defined - those are defined by core modules. Also, I'm not sure that test will pass since it seems to be running on a production site.

Are you able to duplicate this on a fresh install of Drupal core + Token module only?

Noe_’s picture

Nope, I cannot.

That means the code is correct, right?
So there must be something wring in the database?

Or are there any other possibilities?

I think it started when I upgraded from Drupal 6 to Drupal 7

arithmetric’s picture

I ran into a situation where there were no tokens displayed for nodes until I ran the token_clear_cache() function with drush. For example:

drush ev "token_clear_cache();"

Is there a reason this can't be included in the token_flush_caches() function, so it's included when clearing all caches?

Noe_’s picture

This didn't help me though.
I ran it and when I returned to admin/config/search/path/patterns I got the following errors:

    Notice: Undefined index: name in token_asort_tokens() (line 464 of /www/wiredpea/sites/all/modules/token/token.module).
    Notice: Undefined index: name in token_asort_tokens() (line 464 of /www/wiredpea/sites/all/modules/token/token.module).
    Notice: Undefined index: name in token_asort_tokens() (line 464 of /sites/all/modules/token/token.module).
    Notice: Undefined index: name in _token_token_tree_format_row() (line 135 of /sites/all/modules/token/token.pages.inc).
    Notice: Undefined index: description in _token_token_tree_format_row() (line 136 of /sites/all/modules/token/token.pages.inc).
    Notice: Undefined index: name in _token_token_tree_format_row() (line 135 of /sites/all/modules/token/token.pages.inc).
    Notice: Undefined index: description in _token_token_tree_format_row() (line 136 of /sites/all/modules/token/token.pages.inc).
    Notice: Undefined index: name in _token_token_tree_format_row() (line 135 of /sites/all/modules/token/token.pages.inc).
    Notice: Undefined index: description in _token_token_tree_format_row() (line 136 of /sites/all/modules/token/token.pages.inc).
badrun’s picture

Dave Reid’s picture

@Noe_ Check your admin/reports/status page then. It should tell you which tokens are incorrectly defined.

Noe_’s picture

Warning
	Tokens	Problems detected

The following tokens or token types are missing required name and description information:
    * $info['types']['date']
    * $info['tokens']['node']['url']
    * $info['tokens']['file']['size']
    * $info['tokens']['user']['url']
    * $info['tokens']['date']['custom']

The following token types are not defined but have tokens:
    * $info['types']['node']
    * $info['types']['term']
    * $info['types']['vocabulary']
    * $info['types']['file']
    * $info['types']['user']
    * $info['types']['current-user']
capellic’s picture

I'm having some very odd activity similar to the issues discussed here. Tokens were working fine and the, all of a sudden, not generating. This is affecting backup & migrate, menu path, path and node title token profiles. This simply stop working.

Tokens start working again when I all token_clear_cache(); per comment #8 above.

I didn't have cron running on this site yet (it's in development), but I've now set it up to run every hour hoping it will flush the token cache enough so that I never see this issue.

I had been using beta7, but as of now, I've upgraded to the December 14, 2011 version of dev.

capellic’s picture

Reporting back after having installed the DEV version and started my crontab to run every hour. 14 minutes after the cron ran, I did a backup using backup & migrate. The token in the file name for the backup did not get processed. Bummer.

I ran drush ev "token_clear_cache();" and that got things back on track, but this is a very worrisome issue since a lot of my user experience relies up on this. (Panel variants that are looking for specific paths. If the path is not generated correctly by tokens, then the panel variant will not appear.)

fatfish’s picture

Having a similar issue with drupal 7.12 and token 7.x-1.0-rc1
Once clearing the cache I'm getting "Tokens not available" messages on tokens list (on page title modules settings for example"
When I use DEVEL to re-install "token" module, tokens are back, till next cache clear. Since we are still on development, we clear the cache quite often.

Roulion’s picture

I en counter the same issue on a multisite environnement. The strangest thing is my fisrt sites (in D6->D7 migration) works fine, and the second, wich is a fresh install does't work...

I use token 7.1.1.

I also noticed when i istall other modules like RDF the pb desapper till à clear cache...

Roulion’s picture

OK it looks like the issue about missing token $info['types']['file'] comes from file (field) path module.
When i desactivate it, the issue disappear

I use this module with some patch abourt a regex pb and multivalue field (issue #1512466: Multivalue field : only the first field is correctly treated and #1355170: All text-based fields wiped empty after replacing a file in a node and saving.). I will create an issue on filefield module

moniuch’s picture

I have a similar situation in Token 1.1. The errors in status - they all point to (allegedly) multivalue fields.
I say 'allegedly' because body is a single value field and I have:

$info['tokens']['node']['body:0:key']
$info['tokens']['node']['body:0:value']
$info['tokens']['node']['body:1:key']
$info['tokens']['node']['body:1:value']
$info['tokens']['node']['body:2:key']
$info['tokens']['node']['body:2:value']
$info['tokens']['node']['body:3:key']
$info['tokens']['node']['body:3:value']

What is weird is that every field that is listed 4 times, with indices 0...3.

Plus, at the very bottom:
The following token types are not defined but have tokens: $info['types']['taxonomy_term']

trillex’s picture

Version: 7.x-1.0-beta7 » 7.x-1.x-dev

I can confirm this in the latest dev as well. It's affecting Page Titles and Heartbeat. My token list is also empty except for the Google Analytics token, described above. Other than that, I don't have anything else to add.

webmaster-eddie’s picture

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

Subscribe

Same problem, but it is only happening on the site(s) i run that have the most going on - i.e. the most content and the most modules enabled. Clearing the cache sometimes works, but problem re-appears very quickly.

The drush command
drush ev "token_clear_cache();"

solves this problem for me every time, but within an hour the problem re-appears.

advantopher’s picture

Assigned: Unassigned » advantopher

i've the same problem as #19.
the error report shows

$info['tokens']['node']['body:0:key']
$info['tokens']['node']['body:0:value']
$info['tokens']['node']['body:1:key']
$info['tokens']['node']['body:1:value']
$info['tokens']['node']['body:2:key']
$info['tokens']['node']['body:2:value']
$info['tokens']['node']['body:3:key']
$info['tokens']['node']['body:3:value']
$info['tokens']['node']['field_tags:0:key']
$info['tokens']['node']['field_tags:0:value']
$info['tokens']['node']['field_tags:1:key']
$info['tokens']['node']['field_tags:1:value']
$info['tokens']['node']['field_tags:2:key']
$info['tokens']['node']['field_tags:2:value']
$info['tokens']['node']['field_tags:3:key']
$info['tokens']['node']['field_tags:3:value']
... etc.

the error appeares with standard elements as well as manually added elements (e.g. added fields).
there are 72 lines of error messages.

clearing the cache doesn't have any effect.

Thanks for any solution

trillex’s picture

Assigned: advantopher » Unassigned
Priority: Normal » Major
davipilot’s picture

I also have the same issue as above. Running Token 7.x-1.1 and Drupal 7.14.

Dave Reid’s picture

Status: Active » Fixed

You'd have to check with module is adding tokens like [node:body:0:key] because it's not Token module itself. It's trying to warn you about a problem with whatever module defines them.

advantopher’s picture

I'm not sure if this is a solution for anyone, but my problem is solved.

within this token-problem I had a few other ones that I worked with.
when I updated drupal 7.14 to 7.15 and deleted the etracker module (7x-dev) the "token-problem" no longer appeared.

I hope this may help!

Status: Fixed » Closed (fixed)

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

axxint’s picture

Running Drupal 7.9. This error started happening immediately after running update.php for a Devel update: "Convert devel_error_handler variable to devel_error_handlers array" (http://api.drupalize.me/api/drupal/function/devel_update_7004/7). I have confirmed that one of our custom modules is triggering "The following token types are not defined but have tokens:$info['types']['user']"; however everything was working fine with our module and Tokens before that Devel update. We've disabled Devel and the error is still there - so maybe it has something to do with the database? Also, tokens across the board are not working, not just user tokens for which we're getting the error in our status report, but when we disable our custom module, all tokens are working again.

filsterjisah’s picture

I have had the same problem, on "admin/config/people/accounts" there was the message "There are no tokens available". I'd tried everything with token & caching of token tree (static / db) and still no result.

It seemed to be that there was a none-relevant function call that caused the problem. It had byref parameters. In the function definition there were also byref parameters. This caused my problem.
ex.

function a(&$b, &$c) { ... }
// somewhere below the function was called
a(&$d, &$e);

Debug notice: "Deprecated function: Call-time pass-by-reference has been deprecated in drupal_load() (regel 1128 van .../includes/bootstrap.inc)."

The strange thing is that the function is never being called. Seems like a compilation fault...

Anyway i removed the byref in my function call and tokens got generated again...

adrupaler’s picture

Version: 7.x-1.1 » 7.x-1.5

I had the same issue on "admin/config/people/accounts". I almost tried everything to solve the problem.
I've been using call by refrence which is depricated in PHP 5.4 and over.
the #29 solution solved the problem.

alpersari’s picture

had the same issue on "admin/config/people/accounts". My Drupal is 7.24 and Token 7.x-1.5
I can not use tokens in e-mail message templates in the account settings.

phenaproxima’s picture

Issue summary: View changes

I had this problem on Drupal 7.23, Token 1.5, after installing the latest version of Metatag. The solution in #8 fixed it for me.

lookatthosemoose’s picture

Enabling entity_tokens module and clearing cache fixed this for me, using Drupal 7.56 and Token 1.7.