Skip to content

Failed to get object metadata error: name is required #10

@luiseterc

Description

@luiseterc

Description

The application is logging numerous errors with the message Failed to get object metadata error="name is required". This occurs when Kubernetes events have an InvolvedObject reference with an empty Name field.

Impact

  • Error logs are flooding the application output
  • send_errors metric is incorrectly incremented even though events are successfully sent
  • Makes it difficult to identify actual problems in the logs

Root Cause

In pkg/kube/objects.go, the GetObjectMetadata function attempts to fetch object metadata from the Kubernetes API without validating that reference.Name is non-empty. The API call at line 86 requires a name parameter, causing it to fail with "name is required" when the reference has an empty name.

Solution

Add validation to check if reference.Name is empty before attempting the API call. If empty, return an empty ObjectMetadata{} without error, allowing the event to be processed normally without metadata enrichment.

Example Errors

2025-11-07T11:17:58Z ERR Failed to get object metadata error="name is required"
2025-11-07T11:17:22Z ERR Failed to get object metadata error="name is required"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions