{"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":"console","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/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/state_show.go#L31-L67","documentation":"Thrown by `terraform state show` when c.loadPluginPath() returns an error. loadPluginPath reads the forced plugin directories file (.terraform/.terraformrc-relative plugin path marker, i.e. the file written by -plugin-dir) and returns an error if that file exists but cannot be read or fails to JSON-unmarshal. The %s is the underlying read/parse error.","triggerScenarios":"Running `terraform state show <addr>` when .terraform's forced-plugin-dirs file (PluginPathFilename) exists but is unreadable (permissions) or contains invalid JSON (corrupt/truncated), via WorkingDir.ForcedPluginDirs().","commonSituations":"Corrupted forced plugin path file from an interrupted init; permissions change on .terraform/; editor or sync tool truncating the file; mismatched Terraform version writing a different format.","solutions":["Inspect .terraform for the forced plugin path file and validate it is a JSON array of strings.","If corrupt, delete it and re-run `terraform init` to regenerate, or clear forced dirs with `terraform init` without -plugin-dir.","Fix .terraform permissions so the current user can read it.","Re-run `terraform state show` after init succeeds."],"exampleFix":"# before: corrupt forced plugin path file\nterraform state show aws_instance.web\n# error loading plugin path: invalid character...\n\n# after\nrm .terraform/.terraformrc_plugin_path   # remove corrupt marker\nterraform init\nterraform state show aws_instance.web","handlingStrategy":"validation","validationCode":"// before running state show, validate the forced plugin path file is sane.\nfunc validateForcedPluginDirs(path string) error {\n    raw, err := os.ReadFile(path)\n    if os.IsNotExist(err) { return nil }\n    if err != nil { return err }\n    var dirs []string\n    return json.Unmarshal(raw, &dirs)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not manually edit the forced plugin path marker file.","Re-run `terraform init` if you change -plugin-dir usage.","Keep .terraform/ readable by the user running Terraform.","Avoid file-sync tools that truncate small marker files."],"tags":["state-show","plugin-path","json","filesystem"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}