{"record":{"id":"dd1e39c9cdf5bbbe","repo":"googleapis/mcp-toolbox","slug":"resource-conflicts-detected-s-please-ensure","errorCode":null,"errorMessage":"resource conflicts detected:\n  - %s\n\nPlease ensure each source, authService, tool, prompt and group has a unique name across all files","messagePattern":"resource conflicts detected:\n  - (.+?)\n\nPlease ensure each source, authService, tool, prompt and group has a unique name across all files","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/config.go","lineNumber":486,"sourceCode":"\t\t\t\tconflicts = append(conflicts, fmt.Sprintf(\"prompt '%s' (file #%d)\", name, fileIndex+1))\n\t\t\t} else {\n\t\t\t\tmerged.Prompts[name] = prompt\n\t\t\t}\n\t\t}\n\n\t\t// Check for conflicts and merge groups\n\t\tfor name, grp := range file.Groups {\n\t\t\tif _, exists := merged.Groups[name]; exists {\n\t\t\t\tconflicts = append(conflicts, fmt.Sprintf(\"group '%s' (file #%d)\", name, fileIndex+1))\n\t\t\t} else {\n\t\t\t\tmerged.Groups[name] = grp\n\t\t\t}\n\t\t}\n\t}\n\n\t// If conflicts were detected, return an error\n\tif len(conflicts) > 0 {\n\t\treturn Config{}, fmt.Errorf(\"resource conflicts detected:\\n  - %s\\n\\nPlease ensure each source, authService, tool, prompt and group has a unique name across all files\", strings.Join(conflicts, \"\\n  - \"))\n\t}\n\n\t// Ensure only one authService has mcpEnabled = true\n\tvar mcpEnabledAuthServers []string\n\tfor name, authService := range merged.AuthServices {\n\t\t// Only generic type has McpEnabled right now\n\t\tif genericService, ok := authService.(generic.Config); ok && genericService.McpEnabled {\n\t\t\tmcpEnabledAuthServers = append(mcpEnabledAuthServers, name)\n\t\t}\n\t}\n\tif len(mcpEnabledAuthServers) > 1 {\n\t\treturn Config{}, fmt.Errorf(\"multiple authServices with mcpEnabled=true detected: %s. Only one MCP authorization server is currently supported\", strings.Join(mcpEnabledAuthServers, \", \"))\n\t}\n\n\treturn merged, nil\n}\n\n// LoadAndMergeConfigs loads multiple YAML files and merges them","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/cmd/internal/config.go#L468-L504","documentation":"mergeConfigs merges multiple toolbox config files and requires every source, authService, tool, prompt and group name to be globally unique. When the same name appears in more than one file, the merge aborts with a list of all conflicting resource names.","triggerScenarios":"Calling LoadAndMergeConfigs with several --config-file / --prebuilt flags where two files define the same resource name (e.g. both define a source named 'mypg' or a tool named 'execute_sql').","commonSituations":"Combining a prebuilt config with a custom config that reuses a default tool name; team members adding a source with a common name like 'db' in separate files; duplicating a tool block across config files.","solutions":["Rename the duplicate resource in one of the files so names are unique","Remove the redundant duplicate definition from one file","If overriding a prebuilt tool is intended, give the custom tool a distinct name instead of reusing it"],"exampleFix":"// before (file A)\nsources:\n  db: {kind: postgres, ...}\n// after (file B)\nsources:\n  db-app: {kind: postgres, ...}","handlingStrategy":"validation","validationCode":"func checkUniqueNames(files []Config) error {\n  seen := map[string]string{}\n  for _, c := range files {\n    for name := range c.Sources {\n      if prev, dup := seen[name]; dup {\n        return fmt.Errorf(\"source %q duplicated in %s\", name, prev)\n      }\n      seen[name] = \"source\"\n    }\n  }\n  return nil\n}","typeGuard":null,"tryCatchPattern":"cfg, err := parser.LoadAndMergeConfigs(ctx, files)\nif err != nil {\n  if strings.Contains(err.Error(), \"resource conflicts detected\") {\n    // parse conflict list from err.Error(), rename duplicates\n  }\n  return err\n}","preventionTips":["Keep a naming convention/prefix per team or file","Avoid copying prebuilt tool names into custom configs","Lint the merged set of config files in CI before deploy"],"tags":["config-merge","naming-conflict","multi-file"],"backgroundTag":"duplicate-resource-name","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"}