{"record":{"id":"580abf9b71194fbc","repo":"micro/go-micro","slug":"selector-s-not-found","errorCode":null,"errorMessage":"Selector %s not found","messagePattern":"Selector (.+?) not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cmd.go","lineNumber":523,"sourceCode":"\t\t*c.opts.DebugProfile = p()\n\t}\n\n\t// Set the broker\n\tif name := ctx.String(\"broker\"); len(name) > 0 && (*c.opts.Broker).String() != name {\n\t\tb, ok := c.opts.Brokers[name]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"broker %q is not linked into this binary: import go-micro.dev/v6/cmd/defaults to enable flag-selected plugins\", name)\n\t\t}\n\t\tsopts, clopts := c.setBroker(b())\n\t\tserverOpts = append(serverOpts, sopts...)\n\t\tclientOpts = append(clientOpts, clopts...)\n\t}\n\n\t// Set the selector\n\tif name := ctx.String(\"selector\"); len(name) > 0 && (*c.opts.Selector).String() != name {\n\t\ts, ok := c.opts.Selectors[name]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"Selector %s not found\", name)\n\t\t}\n\n\t\t*c.opts.Selector = s(selector.Registry(*c.opts.Registry))\n\n\t\t// No server option here. Should there be?\n\t\tclientOpts = append(clientOpts, client.Selector(*c.opts.Selector))\n\t}\n\n\t// Set the transport\n\tif name := ctx.String(\"transport\"); len(name) > 0 && (*c.opts.Transport).String() != name {\n\t\tt, ok := c.opts.Transports[name]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"transport %q is not linked into this binary: import go-micro.dev/v6/cmd/defaults to enable flag-selected plugins\", name)\n\t\t}\n\n\t\tsopts, clopts := c.setTransport(t())\n\t\tserverOpts = append(serverOpts, sopts...)\n\t\tclientOpts = append(clientOpts, clopts...)","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/cmd/cmd.go#L505-L541","documentation":"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.","triggerScenarios":"Passing --selector cache/roundrobin (etc.) on a binary without the selector plugin package imported, or a typo such as --selector Cache.","commonSituations":"Tuning load-balancing behavior in services built from a minimal template without defaults; docs referencing selector names that differ across go-micro versions.","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."],"exampleFix":"// before\nmicro --selector cache call helloworld ...\n// after: main.go\nimport _ \"go-micro.dev/v6/plugins/selector/cache\"\n// then retry the command","handlingStrategy":"validation","validationCode":"allowedSelectors := map[string]bool{\"\": true, \"cache\": true, \"roundrobin\": true /* linked */}\nif !allowedSelectors[*selectorFlag] {\n    return fmt.Errorf(\"selector %q not registered in this binary\", *selectorFlag)\n}","typeGuard":null,"tryCatchPattern":"if err := c.Run(ctx); err != nil {\n    if strings.HasPrefix(err.Error(), \"Selector \") && strings.HasSuffix(err.Error(), \" not found\") {\n        return fmt.Errorf(\"%w (link the selector plugin package)\", err)\n    }\n    return err\n}","preventionTips":["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."],"tags":["cli","selector","plugin-registration"],"backgroundTag":"plugin-not-linked","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}