{"record":{"id":"601e15d752183ed6","repo":"hashicorp/nomad","slug":"metadata-keys-must-not-be-empty","errorCode":null,"errorMessage":"metadata keys must not be empty","messagePattern":"metadata keys must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/node.go","lineNumber":500,"sourceCode":"type NodeMetaApplyRequest struct {\n\tQueryOptions // Client RPCs must use QueryOptions to set AllowStale=true\n\n\t// NodeID is the node being targeted by this request (or the node\n\t// receiving this request if NodeID is empty).\n\tNodeID string\n\n\t// Meta is the new Node metadata being applied and differs slightly\n\t// from Node.Meta as nil values are used to unset Node.Meta keys.\n\tMeta map[string]*string\n}\n\nfunc (n *NodeMetaApplyRequest) Validate() error {\n\tif len(n.Meta) == 0 {\n\t\treturn fmt.Errorf(\"missing required Meta object\")\n\t}\n\tfor k := range n.Meta {\n\t\tif k == \"\" {\n\t\t\treturn fmt.Errorf(\"metadata keys must not be empty\")\n\t\t}\n\n\t\t// Validate keys are dotted identifiers since their primary use case is in\n\t\t// constraints as interpolated hcl variables.\n\t\t// https://github.com/hashicorp/hcl/blob/v2.16.0/hclsyntax/spec.md#identifiers\n\t\tfor part := range strings.SplitSeq(k, \".\") {\n\t\t\tif !hclsyntax.ValidIdentifier(part) {\n\t\t\t\treturn fmt.Errorf(\"%q is invalid; metadata keys must be valid dotted hcl identifiers\", k)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// NodeMetaResponse is used to read Node metadata directly from Client agents.\ntype NodeMetaResponse struct {\n\t// Meta is the merged static + dynamic Node metadata","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/node.go#L482-L518","documentation":"NodeMetaApplyRequest.Validate found an empty string key in the Meta map; metadata keys are used as interpolated HCL variables in constraints and must be non-empty (nil values unset keys, but keys themselves cannot be \"\").","triggerScenarios":"Thrown at nomad/structs/node.go:500 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove or rename empty metadata keys in the request"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}