Not an ARRAY reference Error causing RT UI inaccesible

Some users were trying to edit some Report Menu Items. On saving RT threw RT internal error. Now login to RT has RT internal error:
image
Now the Logs only show bello ARRAY Error, any help how this can be fixed.

[1205575] [Tue Mar 21 08:41:04 2023] [error]: Not an ARRAY reference at /opt/rt5/sbin/../lib/RT/Interface/Web/MenuBuilder.pm line 217.

Stack:
  [/opt/rt5/sbin/../lib/RT/Interface/Web/MenuBuilder.pm:217]
  [/opt/rt5/share/html/Elements/Tabs:60]
  [/opt/rt5/share/html/index.html:76]
  [/opt/rt5/sbin/../lib/RT/Interface/Web.pm:710]
  [/opt/rt5/sbin/../lib/RT/Interface/Web.pm:389]
  [/opt/rt5/share/html/autohandler:53] (/opt/rt5/sbin/../lib/RT/Interface/Web/Handler.pm:209)
[1205575] [Tue Mar 21 08:41:34 2023] [error]: Not an ARRAY reference at /opt/rt5/sbin/../lib/RT/Interface/Web/MenuBuilder.pm line 217.

Additionally, the ReportMenu builder error was as below:

4495295 [1177047] [Mon Mar 20 18:12:00 2023] [warning]: Use of uninitialized value $printable_args{"Query"} in concatenation (.) or string at /opt/rt5/local/plugins/RT-Extension-ActivityReports/html/Repor        ts/Activity/Elements/ScreenFooter line 7. (/opt/rt5/local/plugins/RT-Extension-ActivityReports/html/Reports/Activity/Elements/ScreenFooter:7)
4495296 [1153083] [Mon Mar 20 18:12:57 2023] [error]: Not an ARRAY reference at /opt/rt5/share/html/Admin/Global/DashboardsInMenu.html line 193.

This reports error was the initial error

Upon investigations looked like editing Reports Menu from RT were the root cause of the problem, where the iitial error was:

[error]: Can't use string ("P3 Medium") as a HASH ref while "strict refs" in use at /opt/rt5/sbin/../lib/RT/Record.pm line 2587.

Now from the menubuilder.pm error, on line 217, I had to edit the follow up lines of code:
The initial code is as follows:

$HTML::Mason::Commands::session{'reports_in_menu'} ||= [];

for my $report ( @{$HTML::Mason::Commands::session{'reports_in_menu'}} ) {
    $reports->child(  $report->{id} =>
        title       => $report->{title},
        path        => $report->{path},

I modified it to look like:

$HTML::Mason::Commands::session{'reports_in_menu'} ||= [];

if (ref($HTML::Mason::Commands::session{'reports_in_menu'}) eq 'ARRAY') {
    for my $report ( @{$HTML::Mason::Commands::session{'reports_in_menu'}} ) {
        $reports->child(  $report->{id} =>
            title       => $report->{title},
            path        => $report->{path},

THis fixed the error, though I am still not ebale to edit reports dashboards but atleast I can access RT UI for now.

1 Like