{"id":"52f8f3684006cdbf","repo":"docker/cli","slug":"node-id-not-found-in-info","errorCode":null,"errorMessage":"node ID not found in /info","messagePattern":"node ID not found in /info","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/node/cmd.go","lineNumber":62,"sourceCode":"// reference is mapped to the current node, hence the node ID is retrieved using\n// the `/info` endpoint.\nfunc Reference(ctx context.Context, apiClient client.APIClient, ref string) (string, error) {\n\tif ref == \"self\" {\n\t\tres, err := apiClient.Info(ctx, client.InfoOptions{})\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif res.Info.Swarm.NodeID == \"\" {\n\t\t\t// If there's no node ID in /info, the node probably\n\t\t\t// isn't a manager. Call a swarm-specific endpoint to\n\t\t\t// get a more specific error message.\n\t\t\t//\n\t\t\t// FIXME(thaJeztah): this should not require calling a Swarm endpoint, and we could just suffice with info / ping (which has swarm status).\n\t\t\t_, err = apiClient.NodeList(ctx, client.NodeListOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn \"\", errors.New(\"node ID not found in /info\")\n\t\t}\n\t\treturn res.Info.Swarm.NodeID, nil\n\t}\n\treturn ref, nil\n}\n","sourceCodeStart":44,"sourceCodeEnd":68,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/node/cmd.go#L44-L68","documentation":"Raised by node.Reference when the special node ref 'self' is resolved via the /info endpoint but Info.Swarm.NodeID is empty. Before erroring, the CLI calls NodeList to try to surface a more specific swarm error (e.g. 'not a swarm manager'); this message is the fallback when that call unexpectedly succeeds.","triggerScenarios":"`docker node inspect self`, `docker node update self`, etc., against a daemon whose /info reports no Swarm.NodeID — typically a node not in a swarm or in an inconsistent swarm state — while NodeList still returns without error.","commonSituations":"Running node commands on a non-swarm engine or a worker via a misdirected DOCKER_HOST/context; a node that just left the swarm; talking to a rootless/dev daemon that never joined a swarm.","solutions":["Verify the daemon is a swarm manager: `docker info --format '{{.Swarm.LocalNodeState}} {{.Swarm.ControlAvailable}}'`","Point DOCKER_HOST/`docker context use` at the intended manager node","Initialize or join the swarm first (`docker swarm init` / `docker swarm join`) before using `docker node` commands","Use an explicit node ID/hostname instead of 'self' if resolving from a different endpoint"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","swarm","node","cli"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}