{"record":{"id":"063cd20cfd42d9dd","repo":"googleapis/mcp-toolbox","slug":"unable-to-access-config-folder-at-q-w","errorCode":null,"errorMessage":"unable to access config folder at %q: %w","messagePattern":"unable to access config folder at %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/config.go","lineNumber":539,"sourceCode":"\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}\n\tif !info.IsDir() {\n\t\treturn nil, fmt.Errorf(\"path %q is not a directory\", folderPath)\n\t}\n\n\t// Find all YAML files in the directory\n\tpattern := filepath.Join(folderPath, \"*.yaml\")\n\tyamlFiles, err := filepath.Glob(pattern)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error finding YAML files in %q: %w\", folderPath, err)\n\t}\n\n\t// Also find .yml files\n\tymlPattern := filepath.Join(folderPath, \"*.yml\")\n\tymlFiles, err := filepath.Glob(ymlPattern)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error finding YML files in %q: %w\", folderPath, err)\n\t}","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/cmd/internal/config.go#L521-L557","documentation":"GetPathsFromConfigFolder stats the given folder path before globbing for YAML files. If os.Stat fails (missing path, permission denied, broken symlink), the error is wrapped with the folder path.","triggerScenarios":"os.Stat(folderPath) fails when calling GetPathsFromConfigFolder with a --config-folder argument that does not exist or is not accessible.","commonSituations":"Typo in the --config-folder path; directory not mounted in a container; relative path resolved from an unexpected working directory; permission restrictions.","solutions":["Verify the folder exists at the given path","Use an absolute path for --config-folder","Fix permissions or mount the directory into the container"],"exampleFix":"// before\ntoolbox --config-folder ./myconfigs   # does not exist\n// after\nmkdir -p ./myconfigs && toolbox --config-folder ./myconfigs","handlingStrategy":"try-catch","validationCode":"if info, err := os.Stat(folder); err != nil {\n  return fmt.Errorf(\"config folder %q inaccessible: %w\", folder, err)\n}","typeGuard":null,"tryCatchPattern":"paths, err := GetPathsFromConfigFolder(ctx, folder)\nif err != nil {\n  var pe *fs.PathError\n  if errors.As(err, &pe) {\n    log.Printf(\"cannot access folder %s: %v\", pe.Path, pe.Err)\n  }\n  return err\n}","preventionTips":["Check the folder exists and is readable before starting","Use absolute paths for --config-folder","Mount config directories explicitly in containers"],"tags":["filesystem","io","config-loading"],"backgroundTag":"file-not-found","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"}