googleapis/mcp-toolbox · error

resource conflicts detected: - %s Please ensure each sour

Error message

resource conflicts detected:
  - %s

Please ensure each source, authService, tool, prompt and group has a unique name across all files

What it means

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.

Source

Thrown at cmd/internal/config.go:486

				conflicts = append(conflicts, fmt.Sprintf("prompt '%s' (file #%d)", name, fileIndex+1))
			} else {
				merged.Prompts[name] = prompt
			}
		}

		// Check for conflicts and merge groups
		for name, grp := range file.Groups {
			if _, exists := merged.Groups[name]; exists {
				conflicts = append(conflicts, fmt.Sprintf("group '%s' (file #%d)", name, fileIndex+1))
			} else {
				merged.Groups[name] = grp
			}
		}
	}

	// If conflicts were detected, return an error
	if len(conflicts) > 0 {
		return 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  - "))
	}

	// Ensure only one authService has mcpEnabled = true
	var mcpEnabledAuthServers []string
	for name, authService := range merged.AuthServices {
		// Only generic type has McpEnabled right now
		if genericService, ok := authService.(generic.Config); ok && genericService.McpEnabled {
			mcpEnabledAuthServers = append(mcpEnabledAuthServers, name)
		}
	}
	if len(mcpEnabledAuthServers) > 1 {
		return Config{}, fmt.Errorf("multiple authServices with mcpEnabled=true detected: %s. Only one MCP authorization server is currently supported", strings.Join(mcpEnabledAuthServers, ", "))
	}

	return merged, nil
}

// LoadAndMergeConfigs loads multiple YAML files and merges them

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Rename the duplicate resource in one of the files so names are unique
  2. Remove the redundant duplicate definition from one file
  3. If overriding a prebuilt tool is intended, give the custom tool a distinct name instead of reusing it

Example fix

// before (file A)
sources:
  db: {kind: postgres, ...}
// after (file B)
sources:
  db-app: {kind: postgres, ...}
Defensive patterns

Strategy: validation

Validate before calling

func checkUniqueNames(files []Config) error {
  seen := map[string]string{}
  for _, c := range files {
    for name := range c.Sources {
      if prev, dup := seen[name]; dup {
        return fmt.Errorf("source %q duplicated in %s", name, prev)
      }
      seen[name] = "source"
    }
  }
  return nil
}

Try / catch

cfg, err := parser.LoadAndMergeConfigs(ctx, files)
if err != nil {
  if strings.Contains(err.Error(), "resource conflicts detected") {
    // parse conflict list from err.Error(), rename duplicates
  }
  return err
}

Prevention

When it happens

Trigger: 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').

Common situations: 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.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/dd1e39c9cdf5bbbe. Report an issue: GitHub.