Cannot merge tickets. Undefined method 'id' for nil:NilClass

Infos:

  • Used Zammad version: 5.0.3-30
  • Used Zammad installation type: docker-compose
  • Operating system: Ubuntu 20.04
  • Browser + version: Edge 97.0.1072.76

Expected behavior:

Go to ticket, click on “Ticket” menu and choose Merge.
Choose ticket to Merge with.
Tickets are Merged.

Actual behavior:

When I click Merge I get the following error

# StatusCode: 500
undefined method `id' for nil:NilClass

Steps to reproduce the behavior:

Go to ticket, click on “Ticket” menu and choose Merge.
Choose ticket to Merge with.

Log output

I, [2022-02-04T09:14:51.950625 #1-2734420] INFO – : Started PUT “/api/v1/ticket_merge/63/79625” for 172.27.0.4 at 2022-02-04 09:14:51 +0100
I, [2022-02-04T09:14:51.968745 #1-2734420] INFO – : Processing by TicketsController#ticket_merge as JSON
I, [2022-02-04T09:14:51.968915 #1-2734420] INFO – : Parameters: {“source_ticket_id”=>“63”, “target_ticket_number”=>“79625”}
E, [2022-02-04T09:14:52.300285 #1-2734420] ERROR – : undefined method id' for nil:NilClass (NoMethodError) app/models/ticket.rb:372:in block in merge_to’
app/models/transaction.rb:17:in block in execute' app/models/transaction.rb:14:in execute’
app/models/transaction.rb:26:in execute' app/models/ticket.rb:296:in merge_to’
app/controllers/tickets_controller.rb:396:in ticket_merge' app/controllers/application_controller/has_download.rb:21:in block (4 levels) in module:HasDownload
app/controllers/application_controller/has_download.rb:20:in block (3 levels) in <module:HasDownload>' app/controllers/application_controller/has_download.rb:19:in block (2 levels) in module:HasDownload
app/controllers/application_controller/handles_transitions.rb:16:in `handle_transaction’
I, [2022-02-04T09:14:52.310073 #1-2734420] INFO – : Completed 500 Internal Server Error in 341ms (Views: 0.2ms | ActiveRecord: 109.8ms | Allocations: 59662)
I, [2022-02-04T09:14:53.138577 #1-2734480] INFO – : Started GET “/api/v1/ticket_articles/353?full=true&=1643959433662" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.145875 #1-2734860] INFO – : Started GET "/api/v1/ticket_articles/345?full=true&
=1643959433663” for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.150871 #1-2664680] INFO – : Started GET “/api/v1/ticket_articles/287?full=true&=1643959433668" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.157947 #1-2734740] INFO – : Started GET "/api/v1/ticket_articles/288?full=true&
=1643959433667” for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.161689 #1-2734900] INFO – : Started GET “/api/v1/ticket_articles/286?full=true&=1643959433669" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.165231 #1-2664800] INFO – : Started GET "/api/v1/ticket_articles/343?full=true&
=1643959433665” for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.180488 #1-2664880] INFO – : Started GET “/api/v1/ticket_articles/304?full=true&=1643959433666" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.184623 #1-2739380] INFO – : Started GET "/api/v1/users/1147?full=true&
=1643959433674” for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.170750 #1-2739280] INFO – : Started GET “/api/v1/ticket_articles/214?full=true&=1643959433672" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.207376 #1-2664800] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.207501 #1-2664800] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433665”, “id”=>“343”}
I, [2022-02-04T09:14:53.210814 #1-2664880] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.214782 #1-2664880] INFO – : Parameters: {“full”=>“true”, “"=>“1643959433666”, “id”=>“304”}
I, [2022-02-04T09:14:53.187027 #1-2739460] INFO – : Started GET "/api/v1/tickets/63?full=true&
=1643959433676” for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.190210 #1-2664680] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.227567 #1-2664680] INFO – : Parameters: {“full”=>“true”, “"=>“1643959433668”, “id”=>“287”}
I, [2022-02-04T09:14:53.193586 #1-2734740] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.228098 #1-2734740] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433667”, “id”=>“288”}
I, [2022-02-04T09:14:53.169800 #1-2734480] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.228498 #1-2734480] INFO – : Parameters: {“full”=>“true”, “"=>“1643959433662”, “id”=>“353”}
I, [2022-02-04T09:14:53.198452 #1-2739560] INFO – : Started GET "/api/v1/ticket_articles/244?full=true&
=1643959433670” for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.196425 #1-2734900] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.238463 #1-2734900] INFO – : Parameters: {“full”=>“true”, “"=>“1643959433669”, “id”=>“286”}
I, [2022-02-04T09:14:53.174984 #1-2734860] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.255595 #1-2734860] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433663”, “id”=>“345”}
I, [2022-02-04T09:14:53.217723 #1-2739380] INFO – : Processing by UsersController#show as JSON
I, [2022-02-04T09:14:53.264165 #1-2739380] INFO – : Parameters: {“full”=>“true”, “"=>“1643959433674”, “id”=>“1147”}
I, [2022-02-04T09:14:53.222029 #1-2739280] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.273071 #1-2739280] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433672”, “id”=>“214”}
I, [2022-02-04T09:14:53.212736 #1-2739640] INFO – : Started GET “/api/v1/tickets/62?full=true&=1643709666359" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.166373 #1-2734420] INFO – : Started GET "/api/v1/ticket_articles/243?full=true&
=1643959433671” for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.172051 #1-2739320] INFO – : Started GET “/api/v1/organizations/56?full=true&=1643959433675" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.243831 #1-2739460] INFO – : Processing by TicketsController#show as JSON
I, [2022-02-04T09:14:53.350728 #1-2739460] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433676”, “id”=>“63”}
I, [2022-02-04T09:14:53.213760 #1-2739680] INFO – : Started GET “/api/v1/organizations/56?full=true&=1643709666358" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.354698 #1-2734420] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.365920 #1-2734420] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433671”, “id”=>“243”}
I, [2022-02-04T09:14:53.387772 #1-2739680] INFO – : Processing by OrganizationsController#show as JSON
I, [2022-02-04T09:14:53.387906 #1-2739680] INFO – : Parameters: {“full”=>“true”, “"=>“1643709666358”, “id”=>“56”}
I, [2022-02-04T09:14:53.304631 #1-2739640] INFO – : Processing by TicketsController#show as JSON
I, [2022-02-04T09:14:53.393826 #1-2739640] INFO – : Parameters: {“full”=>“true”, "
”=>“1643709666359”, “id”=>“62”}
I, [2022-02-04T09:14:53.153530 #1-2734820] INFO – : Started GET “/api/v1/ticket_articles/344?full=true&=1643959433664" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.369399 #1-2739320] INFO – : Processing by OrganizationsController#show as JSON
I, [2022-02-04T09:14:53.398108 #1-2739320] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433675”, “id”=>“56”}
I, [2022-02-04T09:14:53.218860 #1-2739740] INFO – : Started GET “/api/v1/users/1147?full=true&=1643709666357" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.186172 #1-2739420] INFO – : Started GET "/api/v1/ticket_articles/213?full=true&
=1643959433673” for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.415732 #1-2734820] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.421765 #1-2734820] INFO – : Parameters: {“full”=>“true”, “"=>“1643959433664”, “id”=>“344”}
I, [2022-02-04T09:14:53.246208 #1-2739560] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.441568 #1-2739560] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433670”, “id”=>“244”}
I, [2022-02-04T09:14:53.418337 #1-2739740] INFO – : Processing by UsersController#show as JSON
I, [2022-02-04T09:14:53.451124 #1-2739740] INFO – : Parameters: {“full”=>“true”, “"=>“1643709666357”, “id”=>“1147”}
I, [2022-02-04T09:14:53.426802 #1-2739420] INFO – : Processing by TicketArticlesController#show as JSON
I, [2022-02-04T09:14:53.453175 #1-2739420] INFO – : Parameters: {“full”=>“true”, "
”=>“1643959433673”, “id”=>“213”}
I, [2022-02-04T09:14:53.534698 #1-2739980] INFO – : Started GET “/api/v1/tickets/63?all=true&=1643959433677" for 172.27.0.4 at 2022-02-04 09:14:53 +0100
I, [2022-02-04T09:14:53.553982 #1-2739980] INFO – : Processing by TicketsController#show as JSON
I, [2022-02-04T09:14:53.562648 #1-2739980] INFO – : Parameters: {“all”=>“true”, "
”=>“1643959433677”, “id”=>“63”}
I, [2022-02-04T09:14:54.431576 #1-2734740] INFO – : Completed 200 OK in 1203ms (Views: 18.2ms | ActiveRecord: 65.2ms | Allocations: 400781)
I, [2022-02-04T09:14:54.465908 #1-2739680] INFO – : Completed 200 OK in 1078ms (Views: 11.6ms | ActiveRecord: 45.6ms | Allocations: 364705)
I, [2022-02-04T09:14:54.507681 #1-2739460] INFO – : Completed 200 OK in 1147ms (Views: 35.0ms | ActiveRecord: 65.0ms | Allocations: 391583)
I, [2022-02-04T09:14:54.545158 #1-2739740] INFO – : Completed 200 OK in 1094ms (Views: 9.2ms | ActiveRecord: 46.2ms | Allocations: 376221)
I, [2022-02-04T09:14:54.570897 #1-2664800] INFO – : Completed 200 OK in 1363ms (Views: 10.2ms | ActiveRecord: 68.6ms | Allocations: 479492)
I, [2022-02-04T09:14:54.623512 #1-2734820] INFO – : Completed 200 OK in 1195ms (Views: 10.4ms | ActiveRecord: 66.9ms | Allocations: 429875)
I, [2022-02-04T09:14:54.663208 #1-2734860] INFO – : Completed 200 OK in 1404ms (Views: 10.0ms | ActiveRecord: 66.6ms | Allocations: 508010)
I, [2022-02-04T09:14:54.696834 #1-2739380] INFO – : Completed 200 OK in 1427ms (Views: 9.4ms | ActiveRecord: 59.7ms | Allocations: 523555)
I, [2022-02-04T09:14:54.737901 #1-2664880] INFO – : Completed 200 OK in 1515ms (Views: 10.3ms | ActiveRecord: 46.3ms | Allocations: 562070)
I, [2022-02-04T09:14:54.757786 #1-2739640] INFO – : Completed 200 OK in 1364ms (Views: 11.1ms | ActiveRecord: 46.5ms | Allocations: 519821)
I, [2022-02-04T09:14:54.802185 #1-2739420] INFO – : Completed 200 OK in 1347ms (Views: 10.7ms | ActiveRecord: 40.2ms | Allocations: 519532)
I, [2022-02-04T09:14:54.847720 #1-2734900] INFO – : Completed 200 OK in 1599ms (Views: 10.0ms | ActiveRecord: 91.7ms | Allocations: 622954)
I, [2022-02-04T09:14:54.849155 #1-2664680] INFO – : Completed 200 OK in 1621ms (Views: 13.0ms | ActiveRecord: 54.8ms | Allocations: 630956)
I, [2022-02-04T09:14:54.873205 #1-2739320] INFO – : Completed 200 OK in 1475ms (Views: 10.4ms | ActiveRecord: 43.3ms | Allocations: 589566)
I, [2022-02-04T09:14:54.897476 #1-2734420] INFO – : Completed 200 OK in 1519ms (Views: 11.6ms | ActiveRecord: 52.5ms | Allocations: 613233)
I, [2022-02-04T09:14:54.927072 #1-2739280] INFO – : Completed 200 OK in 1654ms (Views: 10.7ms | ActiveRecord: 117.1ms | Allocations: 664913)
I, [2022-02-04T09:14:54.950833 #1-2734480] INFO – : Completed 200 OK in 1722ms (Views: 11.3ms | ActiveRecord: 105.5ms | Allocations: 696287)
I, [2022-02-04T09:14:54.978824 #1-2739560] INFO – : Completed 200 OK in 1536ms (Views: 13.7ms | ActiveRecord: 25.6ms | Allocations: 639347)
I, [2022-02-04T09:14:55.061032 #1-2739980] INFO – : Completed 200 OK in 1498ms (Views: 18.1ms | ActiveRecord: 110.6ms | Allocations: 639344)
I, [2022-02-04T09:14:55.306465 #1-2734740] INFO – : Started POST “/api/v1/integration/smime” for 172.27.0.4 at 2022-02-04 09:14:55 +0100
I, [2022-02-04T09:14:55.320013 #1-2734740] INFO – : Processing by Integration::SMIMEController#search as JSON
I, [2022-02-04T09:14:55.320243 #1-2734740] INFO – : Parameters: {“ticket”=>{“group_id”=>“3”, “owner_id”=>“3”, “state_id”=>“14”, “priority_id”=>“2”, “pending_time”=>“2022-03-01T07:00:00.000Z”}, “article”=>{“body”=>“[FILTERED]”, “type”=>“note”, “internal”=>true, “form_id”=>“961820352”, “subtype”=>“”, “in_reply_to”=>“”, “to”=>“”, “cc”=>“”, “subject”=>“”}}
I, [2022-02-04T09:14:55.380001 #1-2734740] INFO – : Completed 200 OK in 60ms (Views: 0.6ms | ActiveRecord: 19.0ms | Allocations: 8283)
I, [2022-02-04T09:14:57.116375 #1-2739680] INFO – : Started PUT “/api/v1/taskbar/295” for 172.27.0.4 at 2022-02-04 09:14:57 +0100
I, [2022-02-04T09:14:57.127131 #1-2739680] INFO – : Processing by TaskbarController#update as JSON
I, [2022-02-04T09:14:57.127235 #1-2739680] INFO – : Parameters: {“key”=>“Ticket-63”, “client_id”=>“123”, “callback”=>“TicketZoom”, “state”=>{“ticket”=>{}, “article”=>{“form_id”=>“961820352”}}, “params”=>{“ticket_id”=>63, “overview_id”=>12, “shown”=>true}, “prio”=>3, “notify”=>false, “active”=>true, “attachments”=>, “updated_at”=>“2022-02-04T08:02:16.239Z”, “id”=>“295”}
I, [2022-02-04T09:14:57.170777 #1-2739680] INFO – : Completed 200 OK in 43ms (Views: 0.5ms | ActiveRecord: 9.9ms | Allocations: 13409)

I’m afraid I can’t reproduce this behavior.
Could you please update to a more current version to see if this is an temporary issue?

I had a similar issue when testing on 5.1. I’m not 100% sure it’s the same issue, but this was the only forum post that turned up when I searched.

It turned out that I’d renamed the “merged” state to “Merged”. Issue 1876 pointed me in the right direction.

1 Like

@hennning the idea of @asermons could be the right track. Can you check your states? They should look like this:

$ zammad run rails r "puts Ticket::State.all.map(&:name)"
open
new
pending reminder
closed
merged
removed
pending close
1 Like

Hi @rolfschmidt @asermons ,
Thank you both for your responses.
This solved the issue.

We’ve changed the name of all states to “1 New”, “2 Open” etc. to get them in a certain order in the list (and also to have capital first letter).

It’s not just me that wanted capital first letters then :slight_smile:

I’m now going to revert all of the others so I don’t break anything else.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.