googleapis/mcp-toolbox · error

no YAML files found

Error message

no YAML files found

What it means

If, after processing all provided paths, no configs were produced, LoadAndMergeConfigs throws 'no YAML files found'. This is effectively a guard against an empty filePaths list (or a list that yielded nothing usable).

Source

Thrown at cmd/internal/config.go:522

// LoadAndMergeConfigs loads multiple YAML files and merges them
func (p *ConfigParser) LoadAndMergeConfigs(ctx context.Context, filePaths []string) (Config, error) {
	var configs []Config

	for _, filePath := range filePaths {
		buf, err := os.ReadFile(filePath)
		if err != nil {
			return Config{}, fmt.Errorf("unable to read config file at %q: %w", filePath, err)
		}

		config, err := p.ParseConfig(ctx, buf)
		if err != nil {
			return Config{}, fmt.Errorf("unable to parse config file at %q: %w", filePath, err)
		}

		configs = append(configs, config)
	}
	if len(configs) == 0 {
		return Config{}, fmt.Errorf("no YAML files found")
	}
	if len(configs) > 1 {
		mergedFile, err := mergeConfigs(configs...)
		if err != nil {
			return Config{}, fmt.Errorf("unable to merge config files: %w", err)
		}
		return mergedFile, nil
	}
	return configs[0], nil
}

// GetPathsFromConfigFolder loads all YAML files from a directory and merges them
func GetPathsFromConfigFolder(ctx context.Context, folderPath string) ([]string, error) {
	// Check if directory exists
	info, err := os.Stat(folderPath)
	if err != nil {
		return nil, fmt.Errorf("unable to access config folder at %q: %w", folderPath, err)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Pass at least one valid --config-file path
  2. If using a config folder, ensure it contains *.yaml files (rename .yml to .yaml if needed)
  3. Check flag parsing so config paths are actually collected

Example fix

// before (folder contains only config.yml)
// after
mv config.yml config.yaml
Defensive patterns

Strategy: validation

Validate before calling

files, _ := filepath.Glob(filepath.Join(folder, "*.yaml"))
if len(files) == 0 {
  return fmt.Errorf("no *.yaml files in %s (note: .yml is not matched)", folder)
}

Try / catch

cfg, err := parser.LoadConfig(ctx, cfgFile, files)
if err != nil {
  if strings.Contains(err.Error(), "no YAML files found") {
    // provide at least one --config-file
  }
  return err
}

Prevention

When it happens

Trigger: Calling LoadAndMergeConfigs (via LoadConfig with --config-file flags) with an empty file list, or a config-folder expansion that produced no YAML paths.

Common situations: Passing --config-folder pointing at a directory with no *.yaml files (only .yml, which the glob does not match); forgetting all --config-file flags in a code path that requires at least one.

Related errors


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