{"record":{"id":"428b506e02f7a96c","repo":"hashicorp/terraform","slug":"error-loading-plugin-path-s-428b50","errorCode":null,"errorMessage":"error loading plugin path: %s","messagePattern":"error loading plugin path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/state_show.go","lineNumber":49,"sourceCode":"\t// Parse and apply global view arguments\n\tcommon, args := arguments.ParseView(args)\n\tc.View.Configure(common)\n\n\tparsedArgs, diags := arguments.ParseStateShow(args)\n\tif diags.HasErrors() {\n\t\tc.View.Diagnostics(diags)\n\t\tc.View.HelpPrompt(\"state show\")\n\t\treturn 1\n\t}\n\n\tc.Meta.statePath = parsedArgs.StatePath\n\tc.viewType = parsedArgs.ViewType\n\tview := views.NewShow(parsedArgs.ViewType, c.View)\n\n\t// Check for user-supplied plugin path\n\tvar err error\n\tif c.pluginPath, err = c.loadPluginPath(); err != nil {\n\t\tdiags = diags.Append(fmt.Errorf(\"error loading plugin path: %s\", err))\n\t\tview.Diagnostics(diags)\n\t\treturn 1\n\t}\n\n\t// Load the backend\n\tb, diags := c.backend(\".\", c.viewType)\n\tif diags.HasErrors() {\n\t\treturn view.DisplayResourceInstanceState(jsonformat.State{}, diags)\n\t}\n\n\t// We require a local backend\n\tlocal, ok := b.(backendrun.Local)\n\tif !ok {\n\t\tdiags = diags.Append(ErrUnsupportedLocalOp)\n\t\treturn view.DisplayResourceInstanceState(jsonformat.State{}, diags)\n\t}\n\n\t// This is a read-only command","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/state_show.go#L31-L67","documentation":"Thrown by state_show.go when c.loadPluginPath() returns an error. loadPluginPath reads the user-supplied plugin override path (typically from terraform config's `plugin_directory` or the `terraform -plugin-dir` flag) and validates it. The wrapped error is flattened with %s.","triggerScenarios":"A plugin_directory is configured in the CLI config or passed via -plugin-dir, but the path does not exist, is not a directory, is unreadable, or contains invalid entries when Terraform validates it.","commonSituations":"Stale `plugin_directory` in ~/.terraformrc pointing at a removed dir; `-plugin-dir=...` typo; vendored plugin directory was deleted by a clean step; permissions on the plugin cache dir prevent reading.","solutions":["Check ~/.terraformrc (or TF_CLI_CONFIG_FILE) for the `plugin_directory` entry and verify the path exists.","Drop the `-plugin-dir` flag if you want Terraform to use the normal registry install path.","Run `terraform init` to (re)populate the plugin cache.","Fix filesystem permissions on the configured plugin directory."],"exampleFix":"# before\n cat ~/.terraformrc\n plugin_directory = \"/opt/terraform-plugins\"\n\n# after\n mkdir -p /opt/terraform-plugins\n terraform providers lock\n terraform state show aws_instance.web","handlingStrategy":"validation","validationCode":"// Pre-check plugin_directory before invoking state show.\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    view.Diagnostics(diags)\n    return 1\n}","preventionTips":["Drop `plugin_directory` from ~/.terraformrc if you do not need a vendored cache.","Run `terraform init` to populate the cache before `terraform state show`.","Pin plugin cache location with an absolute path in CI.","Validate ~/.terraformrc with `terraform -version` after edits."],"tags":["terraform","state-show","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"}