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/unlock_key.go:75
_, err = apiClient.SwarmUpdate(ctx, client.SwarmUpdateOptions{
Version: res.Swarm.Version,
Spec: res.Swarm.Spec,
RotateManagerUnlockKey: true,
})
if err != nil {
return err
}
if !opts.quiet {
_, _ = fmt.Fprintln(dockerCLI.Out(), "Successfully rotated manager unlock key.")
}
}
resp, err := apiClient.SwarmGetUnlockKey(ctx)
if err != nil {
return fmt.Errorf("could not fetch unlock key: %w", err)
}
if resp.Key == "" {
return errors.New("no unlock key is set")
}
if opts.quiet {
_, _ = fmt.Fprintln(dockerCLI.Out(), resp.Key)
return nil
}
printUnlockCommand(dockerCLI.Out(), resp.Key)
return nil
}
func printUnlockCommand(out io.Writer, unlockKey string) {
if len(unlockKey) > 0 {
_, _ = fmt.Fprintf(out, "To unlock a swarm manager after it restarts, "+View on GitHub (pinned to e9452d6e78)
When it happens
Trigger: Thrown at cli/command/swarm/unlock_key.go:75 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/5c396b8c752b97a9.json.
Report an issue: GitHub.