Skip to content

GitOps labels: Error when deleting static label not present in yaml #28102

@allenhouchins

Description

@allenhouchins

Fleet version: 4.66

Web browser and operating system: Any


💥  Actual behavior

While switching our labels over to gitops, I encountered an error message when the Apply latest action was run and attempting to delete a static label with hosts assigned to it.

Error: DELETE /api/latest/fleet/labels/Santa%20test%20device received status 422 Validation Failed: the operation violates a foreign key constraint on labels: Santa test device

https://github.com/fleetdm/fleet/actions/runs/14384767126/job/40337265572

🧑‍💻  Steps to reproduce

  1. Create a static label in the UI and assign hosts to it
  2. Deploy labels via GitOps, making sure not to include the label you created in the UI so it will delete it
  3. Observe behavior

🕯️ More info (optional)

I had to manually delete the label in question from the UI in order for my GitOps run to succeed.

🛠️ To fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    #g-orchestrationOrchestration product group:reproduceInvolves documenting reproduction steps in the issuebugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions