{"record":{"id":"3c16f8e728eb415b","repo":"docker/cli","slug":"error-reading-plugin-data-w","errorCode":null,"errorMessage":"error reading plugin data: %w","messagePattern":"error reading plugin data: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/plugin/upgrade.go","lineNumber":47,"sourceCode":"\t\t},\n\t\tAnnotations:           map[string]string{\"version\": \"1.26\"},\n\t\tValidArgsFunction:     completeNames(dockerCLI, stateAny), // TODO(thaJeztah): should only complete for the first arg\n\t\tDisableFlagsInUseLine: true,\n\t}\n\n\tflags := cmd.Flags()\n\tflags.BoolVar(&options.grantPerms, \"grant-all-permissions\", false, \"Grant all permissions necessary to run the plugin\")\n\t// TODO(thaJeztah): DEPRECATED: remove in v29.1 or v30\n\tflags.Bool(\"disable-content-trust\", true, \"Skip image verification (deprecated)\")\n\t_ = flags.MarkDeprecated(\"disable-content-trust\", \"support for docker content trust was removed\")\n\tflags.BoolVar(&options.skipRemoteCheck, \"skip-remote-check\", false, \"Do not check if specified remote plugin matches existing plugin image\")\n\treturn cmd\n}\n\nfunc runUpgrade(ctx context.Context, dockerCLI command.Cli, opts pluginOptions) error {\n\tres, err := dockerCLI.Client().PluginInspect(ctx, opts.localName, client.PluginInspectOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading plugin data: %w\", err)\n\t}\n\n\tif res.Plugin.Enabled {\n\t\treturn errors.New(\"the plugin must be disabled before upgrading\")\n\t}\n\n\topts.localName = res.Plugin.Name\n\tif opts.remote == \"\" {\n\t\topts.remote = res.Plugin.PluginReference\n\t}\n\tremote, err := reference.ParseNormalizedNamed(opts.remote)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing remote upgrade image reference: %w\", err)\n\t}\n\tremote = reference.TagNameOnly(remote)\n\n\told, err := reference.ParseNormalizedNamed(res.Plugin.PluginReference)\n\tif err != nil {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/plugin/upgrade.go#L29-L65","documentation":"Returned by runUpgrade (plugin/upgrade.go:47) wrapping the error from PluginInspect. Before upgrading, the CLI inspects the local plugin to read its name and current PluginReference; any failure (plugin missing, daemon unreachable, permission denied) is surfaced with this wrapper so the %w chain preserves the root cause.","triggerScenarios":"Running `docker plugin upgrade` against a plugin name that does not exist locally, when the daemon is not running, or when the API call is denied. Also if the local plugin name is misspelled.","commonSituations":"Upgrading a plugin that was removed, typo in the plugin name, daemon down or socket permission issues, or running upgrade against a remote-only reference with no local install.","solutions":["Verify the plugin exists: `docker plugin ls` and use the exact name.","Ensure the Docker daemon is running and reachable (`docker info`).","Check socket/permissions if you get a connection or forbidden error in the wrapped cause.","Install the plugin first with `docker plugin install` if it is not present."],"exampleFix":"// before\ndocker plugin upgrade typo-name\n// after\ndocker plugin ls   # confirm exact name\ndocker plugin upgrade real-name new-ref:latest","handlingStrategy":"validation","validationCode":"// Confirm the plugin exists before attempting an upgrade.\nfunc pluginExists(ctx context.Context, c client.PluginAPIClient, name string) error {\n    if _, err := c.PluginInspectWithRaw(ctx, name); err != nil {\n        return fmt.Errorf(\"plugin %s not inspectable: %w\", name, err)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Wrap upgrade attempts and report inspect failures distinctly.\nerr := runUpgrade(ctx, cli, opts)\nif err != nil {\n    if strings.Contains(err.Error(), \"error reading plugin data\") {\n        // plugin missing or daemon unreachable; guide user accordingly\n    }\n    return err\n}","preventionTips":["List plugins (`docker plugin ls`) and use the exact name.","Confirm the daemon is up with `docker info`.","Distinguish missing-plugin from daemon errors by inspecting the wrapped cause."],"tags":["plugin","upgrade","inspect","docker-cli"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}