Skip to content

fix: Allow a null label in LabelEventSchema - #3859

Open
pataar wants to merge 1 commit into
jdalrymple:mainfrom
pataar:fix/label-event-null-label
Open

pataar wants to merge 1 commit into
jdalrymple:mainfrom
pataar:fix/label-event-null-label

Conversation

@pataar

@pataar pataar commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Problem

The resource label events endpoints (IssueLabelEvents, MergeRequestLabelEvents, EpicLabelEvents) return "label": null for an event whose label has since been deleted:

{
  "id": 123,
  "user": { "id": 1, "username": "jane", "...": "..." },
  "created_at": "2024-01-29T14:26:49.909+01:00",
  "resource_type": "Issue",
  "resource_id": 456,
  "label": null,
  "action": "add"
}

GitLab keeps the event and nullifies its label reference when the label is removed from the project or group, so any long-lived issue or merge request can carry a few of these. Observed on a self-managed GitLab instance.

LabelEventSchema types the field as label: LabelSchema, so event.label.name compiles without complaint and throws TypeError: Cannot read properties of null (reading 'name') at runtime.

Change

label: LabelSchema → label: LabelSchema | null.

Types only, no runtime change. Nothing inside gitbeaker reads the field. For consumers this surfaces the missing null check at compile time — which is the point, but it does mean code doing event.label.name will need a ?. after upgrading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant