[BUG] EditorialMasterhead - 500 Internal Server Error

Describe the issue or problem
After upgrading to latest 3.5.0, and when running docker, accessing the editorialmasterhead gives a 500 Internal Server Error

Can it be some of the upgrade steps failing? If that is the case, any simple way to fix this table? I can go directly to the database change things if that helps.

In the logs:

[10-Mar-2026 16:50:07 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'u.user_id' in 'on clause' in /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:407
Stack trace:
#0 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(407): PDO->prepare('select `u`.*, `...')
#1 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(812): Illuminate\Database\Connection->Illuminate\Database\{closure}('select `u`.*, `...', Array)
#2 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\Database\Connection->runQueryCallback('select `u`.*, `...', Array, Object(Closure))
#3 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(398): Illuminate\Database\Connection->run('select `u`.*, `...', Array, Object(Closure))
#4 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3106): Illuminate\Database\Connection->select('select `u`.*, `...', Array, true)
#5 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3091): Illuminate\Database\Query\Builder->runSelect()
#6 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3676): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3090): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#8 /var/www/html/lib/pkp/classes/userGroup/Repository.php(587): Illuminate\Database\Query\Builder->get()
#9 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(427): PKP\userGroup\Repository->PKP\userGroup\{closure}()
#10 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(453): Illuminate\Cache\Repository->remember('PKP\\userGroup\\R...', Object(DateInterval), Object(Closure))
#11 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(361): Illuminate\Cache\CacheManager->__call('remember', Array)
#12 /var/www/html/lib/pkp/classes/userGroup/Repository.php(564): Illuminate\Support\Facades\Facade::__callStatic('remember', Array)
#13 /var/www/html/lib/pkp/pages/about/AboutContextHandler.php(99): PKP\userGroup\Repository->getMastheadUserIdsByRoleIds(Array, 3)
#14 [internal function]: PKP\pages\about\AboutContextHandler->editorialMasthead(Array, Object(APP\core\Request))
#15 /var/www/html/lib/pkp/classes/core/PKPRouter.php(327): call_user_func(Array, Array, Object(APP\core\Request))
#16 /var/www/html/lib/pkp/classes/core/PKPPageRouter.php(249): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array, false)
#17 /var/www/html/lib/pkp/classes/core/Dispatcher.php(157): PKP\core\PKPPageRouter->route(Object(APP\core\Request))
#18 /var/www/html/lib/pkp/classes/core/PKPApplication.php(429): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#19 /var/www/html/index.php(21): PKP\core\PKPApplication->execute()
#20 {main}

Next Illuminate\Database\QueryException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'u.user_id' in 'on clause' (Connection: mysql, SQL: select `u`.*, `uugob`.`user_group_id` from `users` as `u` left join `user_user_groups` as `uugob` on `uugob`.`user_id` = `u`.`user_id` where `u`.`disabled` = 0 and exists (select * from `user_user_groups` as `uug` inner join `user_groups` as `ug` on `uug`.`user_group_id` = `ug`.`user_group_id` where `uug`.`user_id` = `u`.`user_id` and `uug`.`user_group_id` in (3, 5, 19) and COALESCE(ug.context_id, 0) in (3) and (`uug`.`date_start` <= 2026-03-10 16:50:07 or `uug`.`date_start` is null) and (`uug`.`date_end` > 2026-03-10 16:50:07 or `uug`.`date_end` is null) and `ug`.`masthead` = 1 and `uug`.`masthead` = 1) order by FIELD(uugob.user_group_id, 3, 5, 19) ASC, (select CONCAT(COALESCE(us_0_0.setting_value, ''), COALESCE(us_1_0.setting_value, '')) from (select 0) as `placeholder` left join `user_settings` as `us_0_0` on `us_0_0`.`user_id` = `u`.`user_id` and `us_0_0`.`setting_name` = familyName and `us_0_0`.`locale` = pt left join `user_settings` as `us_1_0` on `us_1_0`.`user_id` = `u`.`user_id` and `us_1_0`.`setting_name` = givenName and `us_1_0`.`locale` = pt) asc) in /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
Stack trace:
#0 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\Database\Connection->runQueryCallback('select `u`.*, `...', Array, Object(Closure))
#1 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(398): Illuminate\Database\Connection->run('select `u`.*, `...', Array, Object(Closure))
#2 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3106): Illuminate\Database\Connection->select('select `u`.*, `...', Array, true)
#3 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3091): Illuminate\Database\Query\Builder->runSelect()
#4 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3676): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3090): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 /var/www/html/lib/pkp/classes/userGroup/Repository.php(587): Illuminate\Database\Query\Builder->get()
#7 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(427): PKP\userGroup\Repository->PKP\userGroup\{closure}()
#8 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(453): Illuminate\Cache\Repository->remember('PKP\\userGroup\\R...', Object(DateInterval), Object(Closure))
#9 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(361): Illuminate\Cache\CacheManager->__call('remember', Array)
#10 /var/www/html/lib/pkp/classes/userGroup/Repository.php(564): Illuminate\Support\Facades\Facade::__callStatic('remember', Array)
#11 /var/www/html/lib/pkp/pages/about/AboutContextHandler.php(99): PKP\userGroup\Repository->getMastheadUserIdsByRoleIds(Array, 3)
#12 [internal function]: PKP\pages\about\AboutContextHandler->editorialMasthead(Array, Object(APP\core\Request))
#13 /var/www/html/lib/pkp/classes/core/PKPRouter.php(327): call_user_func(Array, Array, Object(APP\core\Request))
#14 /var/www/html/lib/pkp/classes/core/PKPPageRouter.php(249): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array, false)
#15 /var/www/html/lib/pkp/classes/core/Dispatcher.php(157): PKP\core\PKPPageRouter->route(Object(APP\core\Request))
#16 /var/www/html/lib/pkp/classes/core/PKPApplication.php(429): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#17 /var/www/html/index.php(21): PKP\core\PKPApplication->execute()
#18 {main}
  thrown in /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 825
^[c[10-Mar-2026 16:54:12 UTC] PHP Deprecated:  Creation of dynamic property Seboettg\CiteProc\Root\Info::$title-short is deprecated in /var/www/html/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Root/Info.php on line 62
[10-Mar-2026 16:54:12 UTC] PHP Deprecated:  Creation of dynamic property Seboettg\CiteProc\Root\Info::$category is deprecated in /var/www/html/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Root/Info.php on line 62
[10-Mar-2026 16:54:12 UTC] PHP Deprecated:  Creation of dynamic property Seboettg\CiteProc\Root\Info::$updated is deprecated in /var/www/html/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Root/Info.php on line 62
[10-Mar-2026 16:54:12 UTC] PHP Deprecated:  Creation of dynamic property Seboettg\CiteProc\Root\Info::$rights is deprecated in /var/www/html/plugins/generic/citationStyleLanguage/lib/vendor/seboettg/citeproc-php/src/Root/Info.php on line 62

Hi @ambs,

Can you try the following query directly in your SQL client?

select u.*, uugob.user_group_id
from users as u
left join user_user_groups as uugob on uugob.user_id = u.user_id
where u.disabled = 0 and exists (
	select * from user_user_groups as uug
	inner join user_groups as ug on uug.user_group_id = ug.user_group_id
	where uug.user_id = u.user_id
	and uug.user_group_id in (3, 5, 19)
	and COALESCE(ug.context_id, 0) in (3)
	and (uug.date_start <= '2026-03-10 16:50:07' or uug.date_start is null)
	and (uug.date_end > '2026-03-10 16:50:07' or uug.date_end is null)
	and ug.masthead = 1 and uug.masthead = 1)
order by FIELD(uugob.user_group_id, 3, 5, 19) ASC,
(select CONCAT(COALESCE(us_0_0.setting_value, ''), COALESCE(us_1_0.setting_value, '')) from (select 0) as placeholder
left join user_settings as us_0_0 on us_0_0.user_id = u.user_id
and us_0_0.setting_name = 'familyName'
and us_0_0.locale = 'pt'
left join user_settings as us_1_0 on us_1_0.user_id = u.user_id
and us_1_0.setting_name = 'givenName'
and us_1_0.locale = 'pt');

Thanks,
Alec Smecher
Public Knowledge Project Team

Hi, @asmecher

That SQL query returns the ERROR 1054 (42S22): Unknown column ‘u.user_id’ in ‘on clause’

My SQL is very rusty, so asked Claude for some help. His rationale:

The root cause: MySQL doesn’t allow outer query aliases to be referenced inside ON clauses of subqueries — whether in ORDER BY or SELECT. Joining directly in the main query sidesteps the scoping issue entirely and is cleaner anyway.

And his proposed fix (that returns results):

select u.*, uugob.user_group_id
from users as u
left join user_user_groups as uugob on uugob.user_id = u.user_id
left join user_settings as us_family on us_family.user_id = u.user_id
    and us_family.setting_name = 'familyName' and us_family.locale = 'pt'
left join user_settings as us_given on us_given.user_id = u.user_id
    and us_given.setting_name = 'givenName' and us_given.locale = 'pt'
where u.disabled = 0 and exists (
    select * from user_user_groups as uug
    inner join user_groups as ug on uug.user_group_id = ug.user_group_id
    where uug.user_id = u.user_id
    and uug.user_group_id in (3, 5, 19)
    and COALESCE(ug.context_id, 0) in (3)
    and (uug.date_start <= '2026-03-10 16:50:07' or uug.date_start is null)
    and (uug.date_end > '2026-03-10 16:50:07' or uug.date_end is null)
    and ug.masthead = 1 and uug.masthead = 1)
order by FIELD(uugob.user_group_id, 3, 5, 19) ASC,
    CONCAT(COALESCE(us_family.setting_value, ''), COALESCE(us_given.setting_value, ''));

In case it helps, mysql is running in 8.0.19

Thanks

Just noticed the query above returns repeated entries, just for reference. Thanks

@asmecher, sorry to poke. How can this fixed?

In case it helps: fix: use scalar correlated subqueries for name ORDER BY to fix MySQL error by ambs · Pull Request #12482 · pkp/pkp-lib · GitHub