{"record":{"id":"dd88c32755f84abc","repo":"micro/go-micro","slug":"failed-to-load-s-profile-v","errorCode":null,"errorMessage":"failed to load %s profile: %v","messagePattern":"failed to load (.+?) profile: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cmd.go","lineNumber":397,"sourceCode":"\t}\n\tif profileName != \"\" {\n\t\tswitch profileName {\n\t\tcase \"local\":\n\t\t\timported, ierr := mprofile.LocalProfile()\n\t\t\tif ierr != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to load local profile: %v\", ierr)\n\t\t\t}\n\t\t\t*c.opts.Registry = imported.Registry\n\t\t\t*c.opts.Broker = imported.Broker\n\t\t\t*c.opts.Store = imported.Store\n\t\t\t*c.opts.Transport = imported.Transport\n\t\tdefault:\n\t\t\t// Plugin-backed profiles (e.g. nats) register themselves from their\n\t\t\t// own package — linked via go-micro.dev/v6/cmd/defaults or a direct\n\t\t\t// import — so binaries that never select them do not carry them.\n\t\t\timported, ierr := mprofile.Load(profileName)\n\t\t\tif ierr != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to load %s profile: %v\", profileName, ierr)\n\t\t\t}\n\t\t\t// Set the registry\n\t\t\tsopts, clopts := c.setRegistry(imported.Registry)\n\t\t\tserverOpts = append(serverOpts, sopts...)\n\t\t\tclientOpts = append(clientOpts, clopts...)\n\n\t\t\t// set the store\n\t\t\tsopts, clopts = c.setStore(imported.Store)\n\t\t\tserverOpts = append(serverOpts, sopts...)\n\t\t\tclientOpts = append(clientOpts, clopts...)\n\n\t\t\t// set the transport\n\t\t\tsopts, clopts = c.setTransport(imported.Transport)\n\t\t\tserverOpts = append(serverOpts, sopts...)\n\t\t\tclientOpts = append(clientOpts, clopts...)\n\n\t\t\t// Set the broker\n\t\t\tsopts, clopts = c.setBroker(imported.Broker)","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/cmd/cmd.go#L379-L415","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: binary lacks the nats profile\nmicro --profile nats server\n// after: link it in main.go\nimport _ \"go-micro.dev/v6/cmd/defaults\"\n// or specifically:\nimport _ \"go-micro.dev/v6/profile/nats\"","handlingStrategy":"validation","validationCode":"const profiles = map[string]bool{\"local\": true /* + plugin profiles you linked */}\np := flagProfile\nif p != \"\" && !profiles[p] {\n    return fmt.Errorf(\"profile %q is not linked into this binary\", p)\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.New().Run(); err != nil {\n    if strings.HasPrefix(err.Error(), \"failed to load \") {\n        log.Fatalf(\"profile error (check imports/cmd defaults): %v\", err)\n    }\n    log.Fatal(err)\n}","preventionTips":["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."],"tags":["cli","profile","plugin-registration"],"backgroundTag":"profile-load-failed","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}