micro/go-micro · error

store %q is not linked into this binary: import go-micro.dev

Error message

store %q is not linked into this binary: import go-micro.dev/v6/cmd/defaults to enable flag-selected plugins

What it means

When --store <name> is passed, the CLI looks the name up in the map of store constructors registered via plugin init() functions. Unregistered names produce this error, which explicitly says the store plugin is not compiled into the binary and points at importing go-micro.dev/v6/cmd/defaults.

Source

Thrown at cmd/cmd.go:445

		// only change if we have the client and type differs
		if cl, ok := c.opts.Clients[name]; ok && (*c.opts.Client).String() != name {
			*c.opts.Client = cl()
		}
	}

	// Set the server
	if name := ctx.String("server"); len(name) > 0 {
		// only change if we have the server and type differs
		if s, ok := c.opts.Servers[name]; ok && (*c.opts.Server).String() != name {
			*c.opts.Server = s()
		}
	}

	// Set the store
	if name := ctx.String("store"); len(name) > 0 {
		s, ok := c.opts.Stores[name]
		if !ok {
			return fmt.Errorf("store %q is not linked into this binary: import go-micro.dev/v6/cmd/defaults to enable flag-selected plugins", name)
		}

		*c.opts.Store = s(store.WithClient(*c.opts.Client))
	}

	// Set the tracer
	if name := ctx.String("tracer"); len(name) > 0 {
		r, ok := c.opts.Tracers[name]
		if !ok {
			return fmt.Errorf("unsupported tracer: %s", name)
		}

		*c.opts.Tracer = r()
	}

	// Setup auth
	authOpts := []auth.Option{}

View on GitHub (pinned to 24529f1404)

Solutions

  1. Add import _ "go-micro.dev/v6/cmd/defaults" to your binary's main package and rebuild.
  2. Or import only the specific store plugin, e.g. _ "go-micro.dev/v6/util/cmd/store/etcd" style plugin package.
  3. Or omit --store to use the default in-memory store.
  4. Run `micro --help` / `--store` list output to see which stores are actually linked.

Example fix

// before (main.go)
package main
func main() { cmd.New().Run() }
// after
package main
import _ "go-micro.dev/v6/cmd/defaults"
func main() { cmd.New().Run() }
Defensive patterns

Strategy: validation

Validate before calling

// check at startup which stores are linked by attempting a trivial flag parse
// or enforce in main:
if *storeFlag != "" && !linkedStores[*storeFlag] {
    log.Fatalf("store %q unavailable; rebuild with cmd/defaults", *storeFlag)
}

Try / catch

if err := c.Run(ctx); err != nil {
    if strings.Contains(err.Error(), "is not linked into this binary") {
        log.Fatalf("plugin missing: import go-micro.dev/v6/cmd/defaults: %v", err)
    }
    return err
}

Prevention

When it happens

Trigger: Running the micro CLI with --store etcd (or redis, etc.) on a binary that never imported the store plugin package, so c.opts.Stores contains no entry for that name.

Common situations: Using a minimal micro binary (defaults not linked); custom binary in main.go that imports only a subset of plugins; renaming/upgrading where the store plugin name changed.

Related errors


AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01). Data as JSON: /api/errors/ad44f03fe40fbc24. Report an issue: GitHub.