{"record":{"id":"e6e18965b8de526a","repo":"googleapis/mcp-toolbox","slug":"no-yaml-files-found","errorCode":null,"errorMessage":"no YAML files found","messagePattern":"no YAML files found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/config.go","lineNumber":522,"sourceCode":"// LoadAndMergeConfigs loads multiple YAML files and merges them\nfunc (p *ConfigParser) LoadAndMergeConfigs(ctx context.Context, filePaths []string) (Config, error) {\n\tvar configs []Config\n\n\tfor _, filePath := range filePaths {\n\t\tbuf, err := os.ReadFile(filePath)\n\t\tif err != nil {\n\t\t\treturn Config{}, fmt.Errorf(\"unable to read config file at %q: %w\", filePath, err)\n\t\t}\n\n\t\tconfig, err := p.ParseConfig(ctx, buf)\n\t\tif err != nil {\n\t\t\treturn Config{}, fmt.Errorf(\"unable to parse config file at %q: %w\", filePath, err)\n\t\t}\n\n\t\tconfigs = append(configs, config)\n\t}\n\tif len(configs) == 0 {\n\t\treturn Config{}, fmt.Errorf(\"no YAML files found\")\n\t}\n\tif len(configs) > 1 {\n\t\tmergedFile, err := mergeConfigs(configs...)\n\t\tif err != nil {\n\t\t\treturn Config{}, fmt.Errorf(\"unable to merge config files: %w\", err)\n\t\t}\n\t\treturn mergedFile, nil\n\t}\n\treturn configs[0], nil\n}\n\n// GetPathsFromConfigFolder loads all YAML files from a directory and merges them\nfunc GetPathsFromConfigFolder(ctx context.Context, folderPath string) ([]string, error) {\n\t// Check if directory exists\n\tinfo, err := os.Stat(folderPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to access config folder at %q: %w\", folderPath, err)\n\t}","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/cmd/internal/config.go#L504-L540","documentation":"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).","triggerScenarios":"Calling LoadAndMergeConfigs (via LoadConfig with --config-file flags) with an empty file list, or a config-folder expansion that produced no YAML paths.","commonSituations":"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.","solutions":["Pass at least one valid --config-file path","If using a config folder, ensure it contains *.yaml files (rename .yml to .yaml if needed)","Check flag parsing so config paths are actually collected"],"exampleFix":"// before (folder contains only config.yml)\n// after\nmv config.yml config.yaml","handlingStrategy":"validation","validationCode":"files, _ := filepath.Glob(filepath.Join(folder, \"*.yaml\"))\nif len(files) == 0 {\n  return fmt.Errorf(\"no *.yaml files in %s (note: .yml is not matched)\", folder)\n}","typeGuard":null,"tryCatchPattern":"cfg, err := parser.LoadConfig(ctx, cfgFile, files)\nif err != nil {\n  if strings.Contains(err.Error(), \"no YAML files found\") {\n    // provide at least one --config-file\n  }\n  return err\n}","preventionTips":["Ensure config folders contain at least one *.yaml file (rename .yml to .yaml)","Never invoke with an empty file list","Validate flag collection before calling LoadConfig"],"tags":["config-loading","empty-input"],"backgroundTag":"missing-config-file","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"}