Hi Joomshaper team,
I am writing to report a critical bug in the Helix Ultimate System Plugin that causes a 500 Internal Server Error when trying to create Articles or Tags via the native Joomla Core API (Web Services) in Joomla 6.1.0.
Some time ago, on Joomla 5.4.x, I created a component that creates Joomla articles, formatted in JSON so they can be formatted in Page Builder, creates tags and images, and adds an addon that correlates other articles with the same tags at the bottom.
After upgrading to Joomla 6.1, my script crashed with a 500 error. I thought the problem might be related to the update and more stringent changes to the Joomla API.
After debugging, I discovered that the problem is HELIX (latest version), which constantly listens for every activity done in Joomla, even with the API.
Description of the issue:
When pushing a POST request to the Joomla API to create a new article or tag, Joomla triggers the onContentPrepareForm event. The Helix Ultimate system plugin hooks into this event and attempts to fetch the active template at line 120 of plugins/system/helixultimate/helixultimate.php:
$template = Factory::getApplication()->getTemplate(true);
Since the request is handled by the ApiApplication (which has no frontend template assigned, unlike SiteApplication), Joomla 6.1 throws a fatal InvalidArgumentException, crashing the entire API call.
Environment:
Joomla version: 6.1.0
PHP version: 8.x
Helix Ultimate version: last version
Error Log / Stack Trace:
CRITICAL 10.4.71.1 error Uncaught Throwable of type InvalidArgumentException thrown with message "Could not find template "system".". Stack trace:
#0 [ROOT]/plugins/system/helixultimate/helixultimate.php(120): Joomla\CMS\Application\CMSApplication->getTemplate()
#1 [ROOT]/libraries/src/Plugin/CMSPlugin.php(386): PlgSystemHelixultimate->onContentPrepareForm()
#2 [ROOT]/libraries/vendor/joomla/event/src/Dispatcher.php(454): Joomla\CMS\Plugin\CMSPlugin->{closure:Joomla\CMS\Plugin\CMSPlugin::registerLegacyListener():370}()
#3 [ROOT]/libraries/src/MVC/Model/FormBehaviorTrait.php(196): Joomla\Event\Dispatcher->dispatch()
#4 [ROOT]/administrator/components/com_tags/src/Model/TagModel.php(190): Joomla\CMS\MVC\Model\FormModel->loadForm()
...
#12 [ROOT]/libraries/src/Application/ApiApplication.php(116): Joomla\CMS\Application\ApiApplication->dispatch()
Proposed Fix / Workaround:
I managed to temporarily fix the issue on my server by adding an early exit for API clients at the very beginning of the onContentPrepareForm method in helixultimate.php:
PHP
public function onContentPrepareForm(Form $form, $data)
{
// Fix for Joomla API context
if (\Joomla\CMS\Factory::getApplication()->isClient('api')) {
return true;
}
$doc = Factory::getDocument();
// ... rest of the code
}
Could you please review this issue and include a proper context check in the next Helix Ultimate update? API automations are completely broken without this patch.
Thank you for your great work!
Best regards,