Skip to content

[bug-hunter] Filebeat receiver Start returns nil when configured storage extension is missing #49617

@github-actions

Description

@github-actions

Impact

When storage is configured for the Filebeat OTel receiver but the corresponding extension is not present, startup failure is silently swallowed. The receiver reports successful Start() (nil), so the collector can keep running while ingestion never starts.

This is user-impacting because a misconfigured deployment appears healthy at startup and only emits logs, instead of failing fast.

Reproduction Steps

  1. Create a new test file at /tmp/gh-aw/agent/repro_start_swallow_test.go with the code in Failing Test below.
  2. Copy it into the package under test:
    • cp /tmp/gh-aw/agent/repro_start_swallow_test.go x-pack/filebeat/fbreceiver/zz_repro_start_swallow_test.go
  3. Run:
    • go test ./x-pack/filebeat/fbreceiver -run TestReproStartShouldFailWhenStorageExtensionMissing -count=1

Expected vs Actual

Expected: Start() returns an error because storage: elasticsearch_storage is configured but the extension is missing on the host.

Actual: Start() returns nil, and the test fails with:

--- FAIL: TestReproStartShouldFailWhenStorageExtensionMissing (0.06s)
    zz_repro_start_swallow_test.go:33:
        Error:       An error is expected but got nil.
        Messages:    expected Start to fail when storage extension is configured but missing
FAIL
FAIL    github.com/elastic/beats/v7/x-pack/filebeat/fbreceiver    0.092s

Failing Test

package fbreceiver

import (
    "testing"

    "github.com/elastic/beats/v7/x-pack/otel/oteltest"
    "github.com/stretchr/testify/require"
    "go.opentelemetry.io/collector/component"
    "go.opentelemetry.io/collector/consumer/consumertest"
    "go.opentelemetry.io/collector/receiver"
    "go.uber.org/zap"
)

func TestReproStartShouldFailWhenStorageExtensionMissing(t *testing.T) {
    cfg := &Config{Beatconfig: map[string]any{
        "filebeat": map[string]any{"inputs": []map[string]any\{\{
            "type": "benchmark", "enabled": true, "message": "x", "count": 1,
        }}},
        "storage":   "elasticsearch_storage",
        "path.home": t.TempDir(),
    }}

    factory := NewFactoryWithSettings(Settings{Home: t.TempDir()})
    set := receiver.Settings{
        ID: component.NewIDWithName(factory.Type(), "r1"),
        TelemetrySettings: component.TelemetrySettings{Logger: zap.NewNop()},
    }

    r, err := factory.CreateLogs(t.Context(), set, cfg, consumertest.NewNop())
    require.NoError(t, err)

    err = r.Start(t.Context(), &oteltest.MockHost{})
    require.Error(t, err, "expected Start to fail when storage extension is configured but missing")
    _ = r.Shutdown(t.Context())
}

Evidence

  • x-pack/filebeat/fbreceiver/receiver.go:23-33 returns nil from Start() immediately and only logs errors from BeatReceiver.Start(host) in a goroutine.
  • x-pack/libbeat/cmd/instance/receiver.go:149-158 now returns a hard error when configured storage extension lookup fails (error getting ES state store extension).
  • This mismatch makes startup errors observable in logs but not propagated to receiver startup callers.

What is this? | From workflow: Bug Hunter

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

  • expires on Mar 31, 2026, 11:38 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs_teamIndicates that the issue/PR needs a Team:* label

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions