{"record":{"id":"ad21ac3d7ecb4c8e","repo":"googleapis/mcp-toolbox","slug":"name-is-required-unless-group-or-toolset-is","errorCode":null,"errorMessage":"--name is required unless --group or --toolset is set, or exactly one --prebuilt config is provided","messagePattern":"--name is required unless --group or --toolset is set, or exactly one --prebuilt config is provided","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/skills/command.go","lineNumber":264,"sourceCode":"\n// resolveSkillName returns the explicit --name when set. Otherwise, in the\n// single-skill modes it defaults to the --group or --toolset name, and for\n// prebuilt generation it defaults to the config name when exactly one\n// --prebuilt config is given. Any other case requires --name.\nfunc resolveSkillName(name, group, toolset string, prebuiltConfigs []string) (string, error) {\n\tif name != \"\" {\n\t\treturn name, nil\n\t}\n\tif group != \"\" {\n\t\treturn group, nil\n\t}\n\tif toolset != \"\" {\n\t\treturn toolset, nil\n\t}\n\tif len(prebuiltConfigs) == 1 {\n\t\treturn strings.ReplaceAll(prebuiltConfigs[0], \"/\", \"-\"), nil\n\t}\n\treturn \"\", fmt.Errorf(\"--name is required unless --group or --toolset is set, or exactly one --prebuilt config is provided\")\n}\n\nfunc (c *skillsCmd) collectContents(ctx context.Context, opts *internal.ToolboxOptions) (map[string]skillContent, error) {\n\t// Initialize tools and groups only; skills generation does not need live\n\t// sources, auth services, or embedding models.\n\ttoolsMap, groupsMap, err := server.InitializeOfflineConfigs(ctx, opts.Cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialize resources: %w\", err)\n\t}\n\n\treturn c.buildSkillContents(toolsMap, groupsMap)\n}\n\n// buildSkillContents maps each skill name to the tools and description it should\n// be generated with. In group mode, a group's own description takes precedence\n// over the --description flag, which acts as a fallback.\nfunc (c *skillsCmd) buildSkillContents(toolsMap map[string]tools.Tool, groupsMap map[string]group.Group) (map[string]skillContent, error) {\n\tprimitiveMgr := primitives.NewPrimitiveManager(nil, nil, nil, toolsMap, nil, groupsMap)","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/cmd/internal/skills/command.go#L246-L282","documentation":"resolveSkillName validates that a skill name can be derived from the CLI inputs: an explicit --name, a --group, a --toolset, or exactly one --prebuilt config. If none of these can supply a name (empty name, no group/toolset, and zero or multiple prebuilt configs), the command refuses to proceed with this usage error.","triggerScenarios":"Running `toolbox skills` with no --name and none of: a --group, a --toolset, or exactly one --prebuilt flag — e.g. --name omitted with --tools selected, or multiple --prebuilt configs given without --name.","commonSituations":"Forgetting --name when picking individual tools with --tools; passing two or more --prebuilt configs expecting auto-naming; misspelling --group/--toolset so the flag parses as empty; upgrading from a single-prebuilt workflow to multiple prebuilts without adding --name.","solutions":["Add an explicit --name flag (e.g. --name my-skill)","If using --prebuilt, pass exactly one config, or keep multiple but add --name","Verify you passed --group or --toolset (check spelling) if you intended name derivation from them","Run `toolbox skills --help` to review the accepted flag combinations"],"exampleFix":"// before\ntoolbox skills --prebuilt postgres --prebuilt mysql\n// error: --name is required...\n// after\ntoolbox skills --name my-db-skill --prebuilt postgres --prebuilt mysql","handlingStrategy":"validation","validationCode":"# Validate flag combination before invoking\ntoolbox skills --name my-skill --prebuilt postgres  # OK\ntoolbox skills --prebuilt postgres                   # OK (single prebuilt)\ntoolbox skills --prebuilt postgres --prebuilt mysql  # FAILS: needs --name\ntoolbox skills --tools list_tables                   # FAILS: needs --name, --group, or --toolset","typeGuard":null,"tryCatchPattern":"try {\n  execSync(\"toolbox skills --prebuilt postgres --prebuilt mysql\", { stdio: \"inherit\" });\n} catch (e) {\n  if (String(e.stderr).includes(\"--name is required\")) {\n    console.error(\"Add --name or reduce to one --prebuilt config\");\n  } else { throw e; }\n}","preventionTips":["Always pass --name in scripts/CI where flag sets may vary","Remember name auto-derivation only works for exactly one --prebuilt","Double-check --group/--toolset spelling; a misspelled flag won't supply a name","Wrap invocations in a wrapper script that asserts --name is present unless using a single prebuilt"],"tags":["go","cli","validation","usage-error","flags"],"backgroundTag":"missing-required-flag","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}