{"record":{"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":"console","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/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/node/cmd.go#L44-L68","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before (on a non-swarm host)\ndocker node inspect self\n# after\ndocker swarm init\ndocker node inspect self","handlingStrategy":"validation","validationCode":"// Verify swarm membership before resolving 'self'\ninfo, err := apiClient.Info(ctx, client.InfoOptions{})\nif err != nil { return err }\nif info.Info.Swarm.NodeID == \"\" {\n    return fmt.Errorf(\"this node is not in a swarm; run 'docker swarm init'\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run node commands only on swarm managers.","Initialize/join a swarm before using 'self' references.","Prefer explicit node IDs when scripting against remote managers."],"tags":["node","swarm","docker","go","cli"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}