docker/cli ยท error

could not fetch unlock key: %w

Error message

could not fetch unlock key: %w

What it means

Error "could not fetch unlock key: %w" thrown in docker/cli.

Source

Thrown at cli/command/swarm/update.go:70

	opts.mergeSwarmSpec(&sw.Swarm.Spec, flags, &sw.Swarm.ClusterInfo.TLSInfo.TrustRoot)

	curAutoLock := sw.Swarm.Spec.EncryptionConfig.AutoLockManagers

	_, err = apiClient.SwarmUpdate(ctx, client.SwarmUpdateOptions{
		Version: sw.Swarm.Version,
		Spec:    sw.Swarm.Spec,
	})
	if err != nil {
		return err
	}

	_, _ = fmt.Fprintln(dockerCLI.Out(), "Swarm updated.")

	if curAutoLock && !prevAutoLock {
		resp, err := apiClient.SwarmGetUnlockKey(ctx)
		if err != nil {
			return fmt.Errorf("could not fetch unlock key: %w", err)
		}
		printUnlockCommand(dockerCLI.Out(), resp.Key)
	}

	return nil
}

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/swarm/update.go:70 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/5da836381c27f70d.json. Report an issue: GitHub.