From 36885bd1f695958d85909a01e9fcf15dda4f48f4 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:31:14 +0000 Subject: [PATCH] Fix NoMethodError when thread replies enabled and HTTP request fails When chatops_use_thread_replies is enabled and the initial HTTP request fails, Chatopsify::Co#process catches the error and returns nil. The subsequent call to response.dig('id') raises NoMethodError on nil, masking the real error. Use safe navigation operator (response&.dig) to guard against nil response, preventing the misleading NoMethodError. Co-Authored-By: tamphubkdn --- lib/capistrano/tasks/chatopsify.cap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/capistrano/tasks/chatopsify.cap b/lib/capistrano/tasks/chatopsify.cap index a2a1eaa..8b50ade 100644 --- a/lib/capistrano/tasks/chatopsify.cap +++ b/lib/capistrano/tasks/chatopsify.cap @@ -7,7 +7,7 @@ namespace :chatops do info 'Notifying ChatOps of deploy started' begin response = Chatopsify::Co.call.process(Chatopsify::CoLib.msg_fmt(:starting)) - set :chatops_root_id, response.dig('id') if fetch(:chatops_use_thread_replies) + set :chatops_root_id, response&.dig('id') if fetch(:chatops_use_thread_replies) rescue StandardError => e info "ERROR notify_started: #{e}" end