Gridbox returns HTTP 500 instead of 404 for any unmatched page/category/tag URL

Component: com_gridbox (site-side Gridbox router)
Affected file: components/com_gridbox/src/Helper/GridboxHelper.php, method GridboxHelper::raiseError() (around line 12441)

Summary:
Any request for a URL that doesn't match an existing Gridbox page, category, or tag returns a generic HTTP 500 "Whoops, looks like something went wrong" error page instead of a proper 404 Not Found. This affects every mistyped, deleted, or renamed page URL under a Gridbox-managed section of the site — not an isolated case.

Steps to reproduce:

On a site with com_gridbox installed and a published category (e.g. a blog/technology-insights style category), request any URL under that category with a nonexistent alias, e.g. https://yoursite.tld/your-category/this-page-does-not-exist.
Instead of a 404 page, the server returns HTTP 500 with Joomla's generic uncaught-error page.
Root cause:
GridboxHelper::raiseError($code, $message) is:


public static function raiseError($code, $message)
{
switch ($code) {
case 403:
$app = Factory::getApplication();
$app->enqueueMessage($message, 'error');
$app->setHeader('status', $code, true);
break;

default:
throw new \Exception($message, $code);
break;
}
}
For any code other than 403 (which is handled correctly by setting the response header), this throws a plain PHP \Exception($message, $code). This function is called with $code = 404 from multiple places, notably components/com_gridbox/src/Service/Router.php's parse() method (the SEF router), every time an incoming URL segment can't be matched to a page/category/tag alias (see lines ~274, 284, 302, 332, and the local raiseError() wrapper at line ~346).

Joomla's own core router raises a 404 by throwing Joomla\CMS\Router\Exception\RouteNotFoundException (see libraries/src/Router/Router.php line ~166: throw new RouteNotFoundException(Text::_('JERROR_PAGE_NOT_FOUND'));). Joomla's ExceptionHandler/AbstractRenderer pipeline specifically recognizes that class (see libraries/src/Exception/ExceptionHandler.php, logException()) and renders it as a genuine, correctly-statused 404 page. A bare \Exception with $code = 404 does not get this treatment — Joomla has no way to know it was meant to be a "not found" response, so it's handled as an unexpected application error and rendered as a 500.

Suggested fix:
In GridboxHelper::raiseError(), when $code === 404, throw Joomla\CMS\Router\Exception\RouteNotFoundException($message, $code) instead of a generic \Exception. This lets Joomla's own core correctly render a proper 404 page with the right HTTP status, with no other behavior changes needed.

Impact: Any missing/renamed/mistyped page under Gridbox shows visitors and search engines (Google Search Console, etc.) a raw 500 server-error page rather than a normal 404 — this affects SEO (500s are treated very differently from 404s by crawlers) and user experience site-wide, not just one URL.

Replies are visible only to logged in members with an active subscription.