micro/go-micro · error
Selector %s not found
Error message
Selector %s not found
What it means
The --selector flag selects a client selector strategy registered in c.opts.Selectors. Unregistered names yield this error (note the older capitalized message style). The selector is then wired to the current registry and injected into client options.
Source
Thrown at cmd/cmd.go:523
*c.opts.DebugProfile = p()
}
// Set the broker
if name := ctx.String("broker"); len(name) > 0 && (*c.opts.Broker).String() != name {
b, ok := c.opts.Brokers[name]
if !ok {
return fmt.Errorf("broker %q is not linked into this binary: import go-micro.dev/v6/cmd/defaults to enable flag-selected plugins", name)
}
sopts, clopts := c.setBroker(b())
serverOpts = append(serverOpts, sopts...)
clientOpts = append(clientOpts, clopts...)
}
// Set the selector
if name := ctx.String("selector"); len(name) > 0 && (*c.opts.Selector).String() != name {
s, ok := c.opts.Selectors[name]
if !ok {
return fmt.Errorf("Selector %s not found", name)
}
*c.opts.Selector = s(selector.Registry(*c.opts.Registry))
// No server option here. Should there be?
clientOpts = append(clientOpts, client.Selector(*c.opts.Selector))
}
// Set the transport
if name := ctx.String("transport"); len(name) > 0 && (*c.opts.Transport).String() != name {
t, ok := c.opts.Transports[name]
if !ok {
return fmt.Errorf("transport %q is not linked into this binary: import go-micro.dev/v6/cmd/defaults to enable flag-selected plugins", name)
}
sopts, clopts := c.setTransport(t())
serverOpts = append(serverOpts, sopts...)
clientOpts = append(clientOpts, clopts...)View on GitHub (pinned to 24529f1404)
Solutions
- Fix the selector name spelling to the registered key.
- Import the selector plugin package (e.g. _ "go-micro.dev/v6/plugins/selector/cache") or cmd/defaults and rebuild.
- Omit --selector to use the default selector.
- Confirm the selector name with the go-micro version in your go.mod.
Example fix
// before micro --selector cache call helloworld ... // after: main.go import _ "go-micro.dev/v6/plugins/selector/cache" // then retry the command
Defensive patterns
Strategy: validation
Validate before calling
allowedSelectors := map[string]bool{"": true, "cache": true, "roundrobin": true /* linked */}
if !allowedSelectors[*selectorFlag] {
return fmt.Errorf("selector %q not registered in this binary", *selectorFlag)
} Try / catch
if err := c.Run(ctx); err != nil {
if strings.HasPrefix(err.Error(), "Selector ") && strings.HasSuffix(err.Error(), " not found") {
return fmt.Errorf("%w (link the selector plugin package)", err)
}
return err
} Prevention
- Match --selector values exactly to registered selector keys (case-sensitive).
- Import the selector plugin for any load-balancing strategy your scripts select.
- Re-validate selector names after go-micro version bumps.
When it happens
Trigger: Passing --selector cache/roundrobin (etc.) on a binary without the selector plugin package imported, or a typo such as --selector Cache.
Common situations: Tuning load-balancing behavior in services built from a minimal template without defaults; docs referencing selector names that differ across go-micro versions.
Related errors
- failed to load %s profile: %v
- unsupported tracer: %s
- unsupported auth: %s
- unsupported profile: %s
- Cannot use two forms of the same flag: <name> <ff.Name>
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/580abf9b71194fbc.
Report an issue: GitHub.