StatusCode 500 when when loading "My Organization Tickets"

Infos:

  • Used Zammad version: Zammad Version 6.1.0-1701845240.5a81e629.jammy
  • Used Zammad installation type: package
  • Operating system: Ubuntu 22.04.4 LTS
  • Browser + version: Firefox 130.0 + Chromium 127

Expected behavior:

  • Click on “My Organization Tickets” will load and list the ticket of the customer’s organisation. This works out of the box for all but one customer. This one customer has multiple views (Overviews). All customer-specific views do load and show the tickets correctly without an error (including generic/template view “My Tickets”).

Actual behavior:

  • Loading “My Organization Tickets” results in StatusCode: 500 (Please contact your administrator)
  • Backlog says:
E, [2024-09-09T08:32:38.147938#3697374-10752920] ERROR -- : undefined method `assets' for nil:NilClass

    group.assets(data)
         ^^^^^^^ (NoMethodError)
app/models/ticket/assets.rb:36:in `assets'
app/controllers/ticket_overviews_controller.rb:51:in `block (2 levels) in show'
app/controllers/ticket_overviews_controller.rb:49:in `each'
app/controllers/ticket_overviews_controller.rb:49:in `block in show'
app/controllers/ticket_overviews_controller.rb:44:in `each'
app/controllers/ticket_overviews_controller.rb:44:in `show'
app/controllers/application_controller/has_download.rb:17:in `block (4 levels) in <module:HasDownload>'
app/controllers/application_controller/has_download.rb:16:in `block (3 levels) in <module:HasDownload>'
app/controllers/application_controller/has_download.rb:15:in `block (2 levels) in <module:HasDownload>'
app/controllers/application_controller/handles_transitions.rb:16:in `handle_transaction'
E, [2024-09-09T08:32:38.152490#3697374-10752920] ERROR -- : Error ID 3G9A9nX3: undefined method `assets' for nil:NilClass

    group.assets(data)
         ^^^^^^^
I, [2024-09-09T08:32:38.152828#3697374-10752920]  INFO -- : Completed 500 Internal Server Error in 2396ms (Views: 0.2ms | ActiveRecord: 242.8ms | Allocations: 835357)

Steps to reproduce the behavior:

  • I do not know how to reproduce the error, this seems to be specific for this customer. When trying to recreate the issue with another customer - creating organisation-specific views - there is no such problem.
  • From the backlog I assume that one of the returned objects of the array(?) - group - is nil which zammad/rails tries to execute the method assets on. Is there a way to find out what group has that problem?
  • Is this possibly a problem on the data-level of the Zammad-Installation? AFAIK this problem even occured for this customer before upgrading from Zammad 6.0 (and less)
  • I have executed rebuild/cleanup-processes such as

rails r “Rails.cache.clear”
rake zammad:searchindex_rebuild

  • Please let me know if I can provide more information
  • Thank you!

Your Zammad version is outdated, please consider upgrading to 6.3.1 which is a security release before anything else. Your issue might be solved during that process as well.

Thank you for the advise, Mr. Generation.

So I have followed the instructions according to the offical update-guide
Updating from 6.1 to 6.3.1 (“zammad (6.3.1-1725942000.c81e7ad5.jammy) over (6.1.0-1701845240.5a81e629.jammy)”).

I have encountered two major problems which I solved with workarounds for now as follows:
i)

undefined method `connection_config’ for ActiveRecord::Base:Class (NoMethodError)

As suggested by a fellow user I have changed ‘connection_config’ part in db_preferences_postgresql.rb to ‘connection_db_config.configuration_hash’.
I could then continue with the uprade by triggering db-migration with zammad run rake db:migrate

ii)
errors with database-migration

== 20190613000001 GroupDependentTextModules: migrating ========================
– rename_table(:text_modules_groups, :groups_text_modules)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
PG::DuplicateTable: ERROR: relation “groups_text_modules” already exists
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in exec' /opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in block (2 levels) in execute’

/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/migration.rb:954:in method_missing' /opt/zammad/db/migrate/20190613000001_group_dependent_text_modules.rb:5:in change’

Workaround: remove 20190613000001_group_dependent_text_modules.rb from /opt/zammad/db/migrate/
Migration proceeded, and halted again with with:

20190713000001_group_dependent_macros.rb:

PG::DuplicateTable: ERROR: relation “groups_macros” already exists (PG::DuplicateTable)

20191001090809_create_active_job_locks.rb:

PG::DuplicateTable: ERROR: relation “active_job_locks” already exists (PG::DuplicateTable)

The migration went trough (albeit) incomplete and the Zammad-Services are up and running again.
The Zammad-platform is working again, but the original problem persists: My Organization Tickets does not work for one specific customer.

Please let me know how I can go ahead and fix the issue.
Also let me know if the full error log is of help, I can attach that as well of course.
Thank you.

You have not executed database migrations from 2019 and partly change source code in order “to continue the update” and you are wondering what’s wrong?

Your database is in a incomplete state and cannot be trusted. This may cause Zammad to throw errors at some points due to incomplete data sets. That’s out of the scope this community can handle, sorry.

Hi there and thank you for your reply!
Quite certainly those errors do point to the problem.

To look at the issue at hand:
a) relation "groups_text_modules" already exists
This error points to: rename_table :text_modules_groups, :groups_text_modules
Since table groups_text_modules is empty, is it safe to assume that dropping that table would fix the first problem?

b) relation "groups_macros" already exists
This error points to a routine to create a table called ‘groups_macros’ which is empty as well.

c) Same with active_job_locks

Apart from that approach: Is there a general rebuild-/repair-script that you can recommend?

Sorry, fixing your database is out of community scope. This is potentially a process that takes a lot of time which we cannot provide on that level. Sorry.