2.6.5 — 500 errors and bad link tags

Summary

A client website running ModX Revo 2.6.5 started experiencing 500 errors, making the entire website unusable. In addition to finding this error, the hosting company enabled Database caching to help mitigate the server load. After checking over the error log, we found this error repeating multiple times a second, causing a cascade that used up all the server resources:
[2026-02-04 14:29:56] (ERROR in resource 134 @ /var/www/chart.org/core/model/modx/modparser.class.php : 1373) Bad link tag [[~2361]] encountered

The tag ID in question is an Article post (Package: Articles - articles-1.7.13-pl) that was recently published by a user. For reference, the site currently has ~134 articles published. Unpublishing this post stopped the errors and brought the site back up. We deleted this post and recreated it, assuming something had been corrupted somewhere. After recreating the post using our admin account, the issue came back. Even though it was now a different resource ID, the same issue persists.

In the mean time, the resource controlling the site’s homepage (/manager/?a=resource/update&id=1) is now returning a 500 error, leaving both us and the end users unable to make edits here. What’s stranger is that this 500 error is not generating anything in the error log.

While the Article issue is the main issue we’re struggling to decipher, this 500 error from the homepage’s edit screen is even more concerning.

Step to reproduce

We’re unsure what led to the issues in question, so we’ve yet to obtain any meaningful steps to reproduce.

Observed behavior

N/A

Expected behavior

N/A

Environment

MODX 2.6.5p, PHP Version 5.5.9-1, ubuntu4.29, Apache/2.4.7, MySQL 5.5.62

I can’t say why the bad link tag error is happening (any chance the ID there is an Articles ID instead of a MODX Resource ID?) but 500 errors never generate entries in the MODX error log. Those are logged in the server error log.

This is usually a ‘harmless’ error. It just means that there is a link tag ([[~...]]) on page 134 (ERROR in resource 134 ...) with an ID (here 2361) where a corresponding resource can’t be found.
The parser should just replace the ‘bad tag’ with an empty string, and save the result to the cache file for this resource. This error should only show up once in the error log, after the MODX cache was cleared.

There must be something else going on here. Maybe some recursion occurs, so that the same page/chunk is parsed again and again.

Articles (from this extra) are stored in the same database table as ‘normal’ MODX resources. Just the class_key is different.

1 Like

If you are using sibling-nav, I think the bad link tag error is caused by the most recent article not having a “next” sibling. It could also be caused by the first article not having a “previous” sibling.

If you search the modParser class file for “bad link tag” you can find where the error message is generated. I modified mine to show the Resource ID and URIs:

$this->modx->log(
    modX::LOG_LEVEL_ERROR,
         'Bad link tag `' . $this->_tag . '` encountered',
         '',
         $this->modx->resource
              ? "resource {$this->modx->resource->id}"
              : ($_SERVER['REQUEST_URI'] ? "uri   {$_SERVER['REQUEST_URI']}" : '')
);