googleapis/mcp-toolbox · critical

no prebuilt tool configurations were loaded.%w

Error message

no prebuilt tool configurations were loaded.%w

What it means

loadPrebuiltToolYAMLs returns this error when it successfully read the directory but zero .yaml prebuilt configs were registered, leaving the toolYAMLs map empty. (Note: the wrapped %w error is nil here, so the message ends with "%!w(<nil>)".) The binary effectively has no prebuilt configs available.

Source

Thrown at internal/prebuiltconfigs/prebuiltconfigs.go:87

	}

	for _, entry := range entries {
		lowerName := strings.ToLower(entry.Name())
		if !entry.IsDir() && (strings.HasSuffix(lowerName, ".yaml")) {
			filePathInFS := path.Join("tools", entry.Name())
			content, err := prebuiltConfigsFS.ReadFile(filePathInFS)
			if err != nil {
				errMsg := fmt.Errorf("failed to read a prebuilt tool %w", err)
				return nil, nil, errMsg
			}
			sourceTypeKey := entry.Name()[:len(entry.Name())-len(".yaml")]

			sourceTypes = append(sourceTypes, sourceTypeKey)
			toolYAMLs[sourceTypeKey] = content
		}
	}
	if len(toolYAMLs) == 0 {
		errMsg := fmt.Errorf("no prebuilt tool configurations were loaded.%w", err)
		return nil, nil, errMsg
	}

	return toolYAMLs, sourceTypes, nil
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Confirm internal/prebuiltconfigs/tools/ contains at least one *.yaml file (extension must be exactly .yaml, not .yml).
  2. Check the //go:embed pattern in prebuiltconfigs.go includes tools/*.yaml.
  3. Rebuild the binary after restoring the YAML files.
  4. Fix the err arg: pass nil-safe text — the current fmt.Errorf("...%w", err) with nil err prints %!w(<nil>) and masks that there is no underlying cause.

Example fix

// before
if !entry.IsDir() && strings.HasSuffix(lowerName, ".yaml") {
// after (if files are .yml)
if !entry.IsDir() && (strings.HasSuffix(lowerName, ".yaml") || strings.HasSuffix(lowerName, ".yml")) {
Defensive patterns

Strategy: validation

Validate before calling

// CI check: at least one prebuilt YAML exists
yamlFiles, err := filepath.Glob("internal/prebuiltconfigs/tools/*.yaml")
if err != nil || len(yamlFiles) == 0 {
	log.Fatal("no prebuilt *.yaml configs found in internal/prebuiltconfigs/tools/")
}

Try / catch

toolYAMLs, sources, err := loadPrebuiltToolYAMLs()
if err != nil {
	if strings.Contains(err.Error(), "no prebuilt tool configurations were loaded") {
		log.Fatal("build error: embedded tools dir has no *.yaml files")
	}
	return err
}

Prevention

When it happens

Trigger: The embedded tools directory exists but contains no files with a .yaml extension (e.g. all renamed to .yml, files deleted, or the glob in the embed directive excludes them).

Common situations: A cleanup PR renamed YAML files to .yml; CI builds from a stripped repo; someone moved YAMLs to a subdirectory so ReadDir's non-recursive listing sees none.

Related errors


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