micro/go-micro · error
failed to load %s profile: %v
Error message
failed to load %s profile: %v
What it means
For any non-local profile name, the CLI calls mprofile.Load(profileName) to find a profile registered by a plugin package. If the profile is unknown or its loader fails, the error is wrapped and returned from the Before hook, stopping the command. Plugin profiles (e.g. nats) only exist if the corresponding package was imported into the binary.
Source
Thrown at cmd/cmd.go:397
}
if profileName != "" {
switch profileName {
case "local":
imported, ierr := mprofile.LocalProfile()
if ierr != nil {
return fmt.Errorf("failed to load local profile: %v", ierr)
}
*c.opts.Registry = imported.Registry
*c.opts.Broker = imported.Broker
*c.opts.Store = imported.Store
*c.opts.Transport = imported.Transport
default:
// Plugin-backed profiles (e.g. nats) register themselves from their
// own package — linked via go-micro.dev/v6/cmd/defaults or a direct
// import — so binaries that never select them do not carry them.
imported, ierr := mprofile.Load(profileName)
if ierr != nil {
return fmt.Errorf("failed to load %s profile: %v", profileName, ierr)
}
// Set the registry
sopts, clopts := c.setRegistry(imported.Registry)
serverOpts = append(serverOpts, sopts...)
clientOpts = append(clientOpts, clopts...)
// set the store
sopts, clopts = c.setStore(imported.Store)
serverOpts = append(serverOpts, sopts...)
clientOpts = append(clientOpts, clopts...)
// set the transport
sopts, clopts = c.setTransport(imported.Transport)
serverOpts = append(serverOpts, sopts...)
clientOpts = append(clientOpts, clopts...)
// Set the broker
sopts, clopts = c.setBroker(imported.Broker)View on GitHub (pinned to 24529f1404)
Solutions
- Verify the profile name spelling and that a profile with that name exists (e.g. via the profile docs).
- Import the plugin package (or go-micro.dev/v6/cmd/defaults) into your main so the profile self-registers via init().
- Check the wrapped inner error for a loader failure rather than a missing profile.
- Fall back to the built-in "local" profile or explicit component flags (--registry, --broker) instead of a profile.
Example fix
// before: binary lacks the nats profile micro --profile nats server // after: link it in main.go import _ "go-micro.dev/v6/cmd/defaults" // or specifically: import _ "go-micro.dev/v6/profile/nats"
Defensive patterns
Strategy: validation
Validate before calling
const profiles = map[string]bool{"local": true /* + plugin profiles you linked */}
p := flagProfile
if p != "" && !profiles[p] {
return fmt.Errorf("profile %q is not linked into this binary", p)
} Try / catch
if err := cmd.New().Run(); err != nil {
if strings.HasPrefix(err.Error(), "failed to load ") {
log.Fatalf("profile error (check imports/cmd defaults): %v", err)
}
log.Fatal(err)
} Prevention
- Import go-micro.dev/v6/cmd/defaults or each profile package you plan to select.
- Keep the set of allowed profile names in one place and validate flags against it.
- After go-micro version upgrades, re-verify profile names still exist.
When it happens
Trigger: Passing --profile <name> where <name> is misspelled, is a plugin profile whose package was never imported (binary built without cmd/defaults or the plugin), or where the profile's Load function itself errors.
Common situations: Following docs that reference the nats profile without importing the nats defaults package; typo in profile name; custom profile registered under a different name than passed on the command line.
Related errors
- failed to load local profile: %v
- unsupported tracer: %s
- unsupported auth: %s
- unsupported profile: %s
- Selector %s not found
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/dd88c32755f84abc.
Report an issue: GitHub.