{"record":{"id":"d0ab0385d43d4cd8","repo":"googleapis/mcp-toolbox","slug":"error-retrieving-configuration-file-w","errorCode":null,"errorMessage":"error retrieving configuration file: %w","messagePattern":"error retrieving configuration file: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/migrate/command.go","lineNumber":63,"sourceCode":"\treturn cmd.Command\n}\n\nfunc runMigrate(cmd *migrateCmd, opts *internal.ToolboxOptions) error {\n\tctx, cancel := context.WithCancel(cmd.Context())\n\tdefer cancel()\n\n\tctx, shutdown, err := opts.Setup(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\t_ = shutdown(ctx)\n\t}()\n\n\tlogger := opts.Logger\n\tfilePaths, _, err := opts.GetCustomConfigFiles(ctx)\n\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"error retrieving configuration file: %w\", err)\n\t\tlogger.ErrorContext(ctx, errMsg.Error())\n\t\treturn errMsg\n\t}\n\n\tlogger.InfoContext(ctx, \"migration process will start; any comments (except for top-level comments) presented in the original configuration files will not be preserved in the migrated files\")\n\tvar errs []error\n\t// process each files independently.\n\tfor _, filePath := range filePaths {\n\t\tbuf, err := os.ReadFile(filePath)\n\t\tif err != nil {\n\t\t\terrMsg := fmt.Errorf(\"unable to read tool file at %q: %w\", filePath, err)\n\t\t\tlogger.ErrorContext(ctx, errMsg.Error())\n\t\t\terrs = append(errs, errMsg)\n\t\t\tcontinue\n\t\t}\n\t\tnewBuf, err := internal.ConvertConfig(ctx, buf)\n\t\tif err != nil {\n\t\t\tlogger.ErrorContext(ctx, err.Error())","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/cmd/internal/migrate/command.go#L45-L81","documentation":"Raised by `toolbox migrate` when opts.GetCustomConfigFiles fails to resolve the configuration files to migrate (cmd/internal/migrate/command.go:61-66). The wrapped cause usually indicates the --configs/--prebuilt flags point at files or configs that cannot be loaded, parsed, or located.","triggerScenarios":"Running `toolbox migrate` with a --configs path that doesn't exist or isn't readable; malformed YAML that fails config parsing; invalid --prebuilt source name; errors fetching remote config sources.","commonSituations":"Typos in the config file path; running from a different working directory than expected; referencing a prebuilt config kind that doesn't exist; config file failing schema validation during load.","solutions":["Check the wrapped error text after 'error retrieving configuration file:' for the precise cause.","Verify the --configs file path(s) exist relative to the current working directory (or pass absolute paths).","Run `toolbox migrate --configs ./tools.yaml --dry-run` after confirming the file loads with `toolbox --configs ./tools.yaml` (server starts = config valid).","If using --prebuilt, confirm the kind name is valid (see docs/en/integrations prebuilt configs list).","Fix YAML syntax/schema errors so the config parses."],"exampleFix":"// before\n$ toolbox migrate --configs ./tooels.yaml\n// error retrieving configuration file: open tooels.yaml: no such file or directory\n// after\n$ toolbox migrate --configs ./tools.yaml --dry-run","handlingStrategy":"validation","validationCode":"// Verify config resolution before running migrate:\nif _, err := os.Stat(cfgPath); err != nil {\n    log.Fatalf(\"config path not accessible: %v\", err)\n}\n// then sanity-load it:\ncmd := exec.Command(\"toolbox\", \"--configs\", cfgPath, \"--help\")\nif err := cmd.Run(); err != nil {\n    log.Fatalf(\"toolbox cannot load config: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runMigrate(); err != nil {\n    if strings.Contains(err.Error(), \"error retrieving configuration file\") {\n        // resolve config paths / prebuilt name, then retry\n    }\n    return err\n}","preventionTips":["Always pass absolute paths to --configs or run from the config's directory.","Validate configs load with the server briefly before migrating.","Use --dry-run on migrate first to detect resolution issues without writing files.","Confirm --prebuilt kind names against the current toolbox version's supported list."],"tags":["cli","configuration","migration"],"backgroundTag":"config-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"}