docker/cli · error
node ID not found in /info
Error message
node ID not found in /info
What it means
Thrown by the Reference helper (used by node commands to resolve the 'self' keyword) when /info returns an empty Swarm.NodeID. This means the engine is not part of a swarm or is not acting as a manager. The code first attempts a NodeList call to surface a more specific swarm error; if that succeeds, this generic message is returned.
Solutions
- Initialize a swarm on a manager: 'docker swarm init', then run from that node.
- Join this host to an existing swarm as a manager if applicable.
- Use an explicit node ID or hostname instead of 'self' when targeting a remote manager.
Example fix
# before (on a non-swarm host) docker node inspect self # after docker swarm init docker node inspect self
Defensive patterns
Strategy: validation
Validate before calling
// Verify swarm membership before resolving 'self'
info, err := apiClient.Info(ctx, client.InfoOptions{})
if err != nil { return err }
if info.Info.Swarm.NodeID == "" {
return fmt.Errorf("this node is not in a swarm; run 'docker swarm init'")
} Prevention
- Run node commands only on swarm managers.
- Initialize/join a swarm before using 'self' references.
- Prefer explicit node IDs when scripting against remote managers.
When it happens
Trigger: Running 'docker node inspect self', 'docker node ps self', or any node command with 'self' on a daemon that is not in swarm mode or is only a worker node (lines 47-62 of cmd.go).
Common situations: Running node commands on a standalone Docker host with no swarm initialized; executing on a worker node where /info omits the manager NodeID; stale engine state after leaving a swarm.
Related errors
- cannot supply extra formatting options to the pretty…
- when using secret driver secret data must be empty
- error reading from STDIN: data is empty
- secret file is required
- every ip-range or gateway must have a corresponding subnet
AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07).
Data as JSON: /api/errors/52f8f3684006cdbf.
Report an issue: GitHub.
Appendix: source
Thrown at cli/command/node/cmd.go:62
// reference is mapped to the current node, hence the node ID is retrieved using
// the `/info` endpoint.
func Reference(ctx context.Context, apiClient client.APIClient, ref string) (string, error) {
if ref == "self" {
res, err := apiClient.Info(ctx, client.InfoOptions{})
if err != nil {
return "", err
}
if res.Info.Swarm.NodeID == "" {
// If there's no node ID in /info, the node probably
// isn't a manager. Call a swarm-specific endpoint to
// get a more specific error message.
//
// FIXME(thaJeztah): this should not require calling a Swarm endpoint, and we could just suffice with info / ping (which has swarm status).
_, err = apiClient.NodeList(ctx, client.NodeListOptions{})
if err != nil {
return "", err
}
return "", errors.New("node ID not found in /info")
}
return res.Info.Swarm.NodeID, nil
}
return ref, nil
}
View on GitHub (pinned to 4f84911bfe)