jaegertracing/jaeger · error

could not find 'featuregate' command

Error message

could not find 'featuregate' command

What it means

The jaeger featuregate command is implemented as a subcommand inside the OpenTelemetry collector's command tree. newCommand walks otelCmd.Commands() looking for a subcommand named 'featuregate', removes it from the parent so it can be exposed standalone, and panics if no such subcommand exists. This is a build/wiring invariant: the otelcol components-bundled featuregate command must always be registered.

Source

Thrown at cmd/internal/featuregate/command.go:26

	"go.opentelemetry.io/collector/otelcol"
)

func Command() *cobra.Command {
	return newCommand(func() *cobra.Command {
		settings := otelcol.CollectorSettings{}
		return otelcol.NewCommand(settings)
	})
}

func newCommand(otelCmdFn func() *cobra.Command) *cobra.Command {
	otelCmd := otelCmdFn()
	for _, cmd := range otelCmd.Commands() {
		if cmd.Name() == "featuregate" {
			otelCmd.RemoveCommand(cmd)
			return cmd
		}
	}
	panic("could not find 'featuregate' command")
}

View on GitHub (pinned to 806f444784)

Solutions

  1. Check the otel collector version in go.mod and confirm the featuregate command is still registered under that name; pin/restore a version that has it
  2. Re-run make generate / rebuild to ensure components and their commands are linked in (blank imports of the collector components)
  3. If the command was renamed upstream, update the string literal 'featuregate' in cmd/internal/featuregate/command.go to the new name

Example fix

// before
if cmd.Name() == "featuregate" {
// after (if upstream renamed it)
if cmd.Name() == "featuregate" || cmd.Name() == "feature-gate" {
Defensive patterns

Strategy: validation

Validate before calling

for _, cmd := range otelCmd.Commands() {
    if cmd.Name() == "featuregate" { /* ok */ }
}

Try / catch

defer func() { if r := recover(); r != nil { log.Fatalf("featuregate command missing from otelcmd: %v", r) } }()

Prevention

When it happens

Trigger: Running any code path that builds the standalone featuregate CLI command when the embedded otelcol command tree does not contain a child named 'featuregate' — e.g. after an OTel collector dependency upgrade that renamed or dropped the featuregate command.

Common situations: Upgrading github.com/open-telemetry/opentelemetry-collector or the jaeger component deps where the featuregate command was moved/renamed; a custom build trimming components; copy-pasting newCommand into a binary that wires a different otelcmd.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/d7804937cd543833. Report an issue: GitHub.