{"record":{"id":"d7804937cd543833","repo":"jaegertracing/jaeger","slug":"could-not-find-featuregate-command","errorCode":null,"errorMessage":"could not find 'featuregate' command","messagePattern":"could not find 'featuregate' command","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/featuregate/command.go","lineNumber":26,"sourceCode":"\t\"go.opentelemetry.io/collector/otelcol\"\n)\n\nfunc Command() *cobra.Command {\n\treturn newCommand(func() *cobra.Command {\n\t\tsettings := otelcol.CollectorSettings{}\n\t\treturn otelcol.NewCommand(settings)\n\t})\n}\n\nfunc newCommand(otelCmdFn func() *cobra.Command) *cobra.Command {\n\totelCmd := otelCmdFn()\n\tfor _, cmd := range otelCmd.Commands() {\n\t\tif cmd.Name() == \"featuregate\" {\n\t\t\totelCmd.RemoveCommand(cmd)\n\t\t\treturn cmd\n\t\t}\n\t}\n\tpanic(\"could not find 'featuregate' command\")\n}\n","sourceCodeStart":8,"sourceCodeEnd":28,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/internal/featuregate/command.go#L8-L28","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","Re-run make generate / rebuild to ensure components and their commands are linked in (blank imports of the collector components)","If the command was renamed upstream, update the string literal 'featuregate' in cmd/internal/featuregate/command.go to the new name"],"exampleFix":"// before\nif cmd.Name() == \"featuregate\" {\n// after (if upstream renamed it)\nif cmd.Name() == \"featuregate\" || cmd.Name() == \"feature-gate\" {","handlingStrategy":"validation","validationCode":"for _, cmd := range otelCmd.Commands() {\n    if cmd.Name() == \"featuregate\" { /* ok */ }\n}","typeGuard":null,"tryCatchPattern":"defer func() { if r := recover(); r != nil { log.Fatalf(\"featuregate command missing from otelcmd: %v\", r) } }()","preventionTips":["Pin and review otel collector dependency versions; diff the component command registry on upgrades","Add a startup smoke test that constructs the featuregate command","Grep upstream releases for featuregate command renames before bumping deps"],"tags":["panic","cli","otelcol","dependency-drift"],"backgroundTag":"missing-subcommand","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}