{"record":{"id":"75a0c4a091be675b","repo":"hashicorp/terraform","slug":"error-loading-plugin-path-s-75a0c4","errorCode":null,"errorMessage":"error loading plugin path: %s","messagePattern":"error loading plugin path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/validate.go","lineNumber":79,"sourceCode":"\n\tvar varDiags tfdiags.Diagnostics\n\tc.VariableValues, varDiags = args.Vars.CollectValues(func(filename string, src []byte) {\n\t\tloader.Parser().ForceFileSource(filename, src)\n\t})\n\tif varDiags.HasErrors() {\n\t\tdiags = diags.Append(varDiags)\n\t\treturn view.Results(diags)\n\t}\n\n\tdir, err := filepath.Abs(args.Path)\n\tif err != nil {\n\t\tdiags = diags.Append(fmt.Errorf(\"unable to locate module: %s\", err))\n\t\treturn view.Results(diags)\n\t}\n\n\t// Check for user-supplied plugin path\n\tif c.pluginPath, err = c.loadPluginPath(); err != nil {\n\t\tdiags = diags.Append(fmt.Errorf(\"error loading plugin path: %s\", err))\n\t\treturn view.Results(diags)\n\t}\n\n\tvalidateDiags := c.validate(dir)\n\tdiags = diags.Append(validateDiags)\n\n\t// Validating with dev overrides in effect means that the result might\n\t// not be valid for a stable release, so we'll warn about that in case\n\t// the user is trying to use \"terraform validate\" as a sort of pre-flight\n\t// check before submitting a change.\n\tdiags = diags.Append(c.providerDevOverrideRuntimeWarnings())\n\n\treturn view.Results(diags)\n}\n\nfunc (c *ValidateCommand) validate(dir string) tfdiags.Diagnostics {\n\tvar diags tfdiags.Diagnostics\n\tvar cfg *configs.Config","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/validate.go#L61-L97","documentation":"Thrown by validate.go when c.loadPluginPath() returns an error during `terraform validate`. Identical mechanism to [754]: a user-supplied plugin_directory (CLI config or -plugin-dir) is invalid, missing, or unreadable. Wrapped with %s.","triggerScenarios":"`terraform validate` invoked with a configured plugin_directory that does not exist, is not a directory, is unreadable, or fails validation when Terraform scans its contents.","commonSituations":"Vendored plugin directory removed by `make clean` or git clean; CI image missing the plugin cache volume; ~/.terraformrc `plugin_directory` left over from a different machine; -plugin-dir passed with a typo.","solutions":["Inspect ~/.terraformrc / TF_CLI_CONFIG_FILE for `plugin_directory` and validate the path.","Drop `-plugin-dir` and run `terraform init` to install providers normally.","Recreate the plugin cache: `terraform providers lock` then `terraform init`.","Fix permissions on the configured plugin directory."],"exampleFix":"# before\n terraform validate -plugin-dir=/opt/tf-plugins\n\n# after\n rm ~/.terraformrc   # or fix plugin_directory\n terraform init\n terraform validate","handlingStrategy":"validation","validationCode":"// Validate plugin_directory before validate.\nif c.pluginPath != \"\" {\n    if info, err := os.Stat(c.pluginPath); err != nil || !info.IsDir() {\n        return fmt.Errorf(\"plugin_directory %s invalid: %w\", c.pluginPath, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if c.pluginPath, err = c.loadPluginPath(); err != nil {\n    diags = diags.Append(fmt.Errorf(\"error loading plugin path: %s; remove plugin_directory from CLI config or fix path\", err))\n    return view.Results(diags)\n}","preventionTips":["Drop `plugin_directory` from ~/.terraformrc if unused.","Run `terraform init` before `terraform validate` to populate the plugin cache.","Use absolute paths for plugin caches in CI.","Re-create any vendored plugin dir before invoking validate."],"tags":["terraform","validate","plugin","filesystem","cli-config"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}