Just for those who still struggle with this problem.
I work with a modx version that started at 2.06 and now is upgraded to 2.2.13.
I was trying to create a canonical URL to a page in another context
[[*canonical:!empty=`<link rel="canonical" href="[[~[[*canonical]]? &scheme=`full`]]" />`]]
The ID of the ressource in that other context is put in the TV canonical...
I have 8 contexts for some like the web context the URL generation worked for some not. I then right klicked in the tree on each context to edit it and made sure that the permission for the user group (anonymous) was set to 9999, load only.
This was the case in all the contexts.
Also I checked that I have set the site_url, base_url and http_host accordingly. All looked good but I still only had it work on some contexts and on others not.
The solution to this problem was:
I had to manually delete the (anonymous) entry on the context it self.
Then I went to the menu "Security -> Access Control" there you have the list with all the users. I selected (anonymous) and set edit.
There you can globally configure the context settings for anonymous. So I did set the setting for each context again: 9999, load only
Flushed the permissions and also reset all sessions.
And it worked.
I have reason to beleive that by adding the permission on the context caused somehow an error. It can be that this is fixed in new versions, but when you have done it that way and added it a while ago. You might have the same issuee.
Cheers