docker/cli ยท error

failed to unmarshal hook response (%q): %w

Error message

failed to unmarshal hook response (%q): %w

What it means

Error "failed to unmarshal hook response (%q): %w" thrown in docker/cli.

Source

Thrown at cli-plugins/manager/hooks.go:91

		}

		p, err := getPlugin(pluginName, pluginDirs, rootCmd)
		if err != nil {
			return nil, false, err
		}

		resp, err := p.RunHook(ctx, hooks.Request{
			RootCmd:      match,
			Flags:        flags,
			CommandError: cmdErrorMessage,
		})
		if err != nil {
			return nil, false, err
		}

		var message hooks.Response
		if err := json.Unmarshal(resp, &message); err != nil {
			return nil, false, fmt.Errorf("failed to unmarshal hook response (%q): %w", string(resp), err)
		}

		// currently the only hook type
		if message.Type != hooks.NextSteps {
			return nil, false, errors.New("unexpected hook response type: " + strconv.Itoa(int(message.Type)))
		}

		messages, err = hooks.ParseTemplate(message.Template, subCmd)
		if err != nil {
			return nil, false, err
		}

		return messages, true, nil
	}

	for pluginName, pluginCfg := range pluginsCfg {
		messages, ok, err := tryInvokeHook(pluginName, pluginCfg)
		if err != nil {

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli-plugins/manager/hooks.go:91 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/e8067426e3f04362.json. Report an issue: GitHub.