{"record":{"id":"5726fe7e8105af81","repo":"hashicorp/nomad","slug":"missing-node-pool-name","errorCode":null,"errorMessage":"missing node pool name","messagePattern":"missing node pool name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/node_pools.go","lineNumber":54,"sourceCode":"\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn resp, qm, nil\n}\n\n// PrefixList is used to list node pools that match a given prefix.\nfunc (n *NodePools) PrefixList(prefix string, q *QueryOptions) ([]*NodePool, *QueryMeta, error) {\n\tif q == nil {\n\t\tq = &QueryOptions{}\n\t}\n\tq.Prefix = prefix\n\treturn n.List(q)\n}\n\n// Info is used to fetch details of a specific node pool.\nfunc (n *NodePools) Info(name string, q *QueryOptions) (*NodePool, *QueryMeta, error) {\n\tif name == \"\" {\n\t\treturn nil, nil, errors.New(\"missing node pool name\")\n\t}\n\n\tvar resp NodePool\n\tqm, err := n.client.query(\"/v1/node/pool/\"+url.PathEscape(name), &resp, q)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn &resp, qm, nil\n}\n\n// Register is used to create or update a node pool.\nfunc (n *NodePools) Register(pool *NodePool, w *WriteOptions) (*WriteMeta, error) {\n\tif pool == nil {\n\t\treturn nil, errors.New(\"missing node pool\")\n\t}\n\tif pool.Name == \"\" {\n\t\treturn nil, errors.New(\"missing node pool name\")\n\t}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/api/node_pools.go#L36-L72","documentation":"Guard in NodePools.Info: the node pool name used to build the /v1/node/pool/<name> query was an empty string; the caller must supply a concrete pool name.","triggerScenarios":"Calling n.Info(\"\", q) with a name sourced from an empty flag, unset config value, or empty node's NodePool field (older nodes without pool assignment).","commonSituations":"CLI flag --node-pool not provided; reading NodePool off a pre-0.17 node struct where it defaults to empty; config interpolation resolving to an empty string.","solutions":["Pass a non-empty pool name; default to \"default\" when the name is empty","Validate the name argument before calling Info","Check where the name is sourced (flag/config/node field) and ensure it is populated"],"exampleFix":"// before\npool, _, err := np.Info(name, nil)\n// after\nif name == \"\" {\n    name = \"default\"\n}\npool, _, err := np.Info(name, nil)","handlingStrategy":"validation","validationCode":"func poolNameOK(name string) bool { return name != \"\" }","typeGuard":null,"tryCatchPattern":"pool, _, err := nodePools.Info(name, nil)\nif err != nil && strings.Contains(err.Error(), \"missing node pool name\") {\n    return fmt.Errorf(\"node pool name required (got empty)\")\n}","preventionTips":["Default empty pool names to \"default\" when appropriate","Validate CLI flags/config before calling the API","Handle older node structs whose NodePool field is empty"],"tags":["go","nomad","node-pools","empty-string","client-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}