{"record":{"id":"b90302340ea316fb","repo":"mikefarah/yq","slug":"unsupported-node-kind-v","errorCode":null,"errorMessage":"unsupported node kind: %v","messagePattern":"unsupported node kind: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/yqlib/encoder_hcl.go","lineNumber":688,"sourceCode":"\t\t\t\treturn cty.NilVal, err\n\t\t\t}\n\t\t\tm[keyNode.Value] = v\n\t\t}\n\t\treturn cty.ObjectVal(m), nil\n\tcase SequenceNode:\n\t\tvals := make([]cty.Value, len(node.Content))\n\t\tfor i, item := range node.Content {\n\t\t\tv, err := nodeToCtyValue(item)\n\t\t\tif err != nil {\n\t\t\t\treturn cty.NilVal, err\n\t\t\t}\n\t\t\tvals[i] = v\n\t\t}\n\t\treturn cty.TupleVal(vals), nil\n\tcase AliasNode:\n\t\treturn cty.NilVal, fmt.Errorf(\"HCL encoder does not support aliases\")\n\tdefault:\n\t\treturn cty.NilVal, fmt.Errorf(\"unsupported node kind: %v\", node.Kind)\n\t}\n}\n","sourceCodeStart":670,"sourceCodeEnd":691,"githubUrl":"https://github.com/mikefarah/yq/blob/8b5af0694bb82b41d4ae180fac9972029066f90a/pkg/yqlib/encoder_hcl.go#L670-L691","documentation":"nodeToCtyValue converts CandidateNode kinds into cty values for HCL attribute encoding; when it encounters a node kind it has no case for (anything other than scalar/mapping/sequence/alias handled above), it returns this unsupported-kind error. It indicates an internal/unexpected node type reached the HCL value converter.","triggerScenarios":"Encoding to HCL when a value node is of an unexpected Kind not covered by the switch in nodeToCtyValue (e.g. unusual internal node kinds introduced by prior operations in the pipeline).","commonSituations":"Chaining yq operators that produce synthetic node kinds and then piping to `-o hcl`; edge cases after custom type tags or document fragments leak into the value position.","solutions":["Inspect the input for exotic node types and normalize data before `-o hcl`","Round-trip through JSON (`yq -o json | yq -o hcl`) to normalize kinds to scalar/map/seq","If it persists with plain input, file a bug with the input document and expression"],"exampleFix":"// before: yq -o hcl '<expr producing odd node>'\n// after:  yq -o json '<expr>' | yq -o hcl '.'   # normalize node kinds first","handlingStrategy":"try-catch","validationCode":"// normalize node kinds first, then only scalar/map/seq should remain:\n// yq -o json '<expr>' | yq '[.. | tag] | unique'","typeGuard":"func kindIsSupported(node *CandidateNode) bool {\n  switch node.Kind {\n  case ScalarNode, MappingNode, SequenceNode: return true\n  default: return false\n  }\n}","tryCatchPattern":"v, err := nodeToCtyValue(node)\nif err != nil && strings.Contains(err.Error(), \"unsupported node kind\") {\n    return normalizeAndRetry(node) // e.g. re-decode from JSON output\n}","preventionTips":["Avoid pipelines that emit synthetic/internal node kinds directly into -o hcl","Round-trip through JSON to normalize kinds before HCL encoding","Report persistent occurrences with input + expression to the yq maintainers"],"tags":["hcl","encoding","unsupported-kind","yq"],"backgroundTag":"hcl-unsupported-node-kind","analyzedSha":"8b5af0694bb82b41d4ae180fac9972029066f90a","analyzedAt":"2026-09-05T10:57:22.766Z","contentChangedAt":"2026-09-05T10:57:22.766Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}