#39737·n8n

GitLab Trigger checkExists can mishandle 404 and crash on missing error description

Author: sergioperezchecoCreated Sep 28, 2026Updated Sep 28, 2026
Labelsteam:nodesstatus:in-linearstatus:team-assigned

Bug Description

The GitLab Trigger's webhook checkExists handler reads error.cause.httpCode when the GitLab API returns a 404. gitlabApiRequest wraps request failures as NodeApiError, whose resolved status is available on error.httpCode. The fallback then calls error.description.includes('404') without checking whether description exists. A missing webhook can therefore be handled as an unrelated exception rather than returning false and clearing the stale webhook ID; an error without a description can instead throw a TypeError while handling the original error.

To Reproduce

  1. Configure a GitLab Trigger with a stored webhook ID.
  2. Have its GET /projects/{project}/hooks/{id} request reject with a NodeApiError whose httpCode is '404' and whose description is empty or absent.
  3. Invoke webhookMethods.default.checkExists. The existing error.cause.httpCode/error.description.includes(...) path does not reliably recognize the 404. The regression tests in PR #35486 exercise this handler directly.

Expected behavior

A 404 should clear the stale webhook ID/events/secret and return false so the webhook can be recreated. Non-404 errors should propagate unchanged, including errors without a description.

This report is for the error-handling branch of checkExists, not the unrelated DELETE failure discussed in #4217. Fix and regression tests: #35486.