mikefarah/yq · error

unsupported node %v

Error message

unsupported node %v

What it means

The shell-variables encoder emits each leaf as a shell variable assignment; it handles scalars, maps, sequences, and aliases, and anything else hits 'unsupported node %v' with the node's Tag. Non-standard node kinds cannot be expressed as `name=value` shell variables.

Source

Thrown at pkg/yqlib/encoder_shellvariables.go:89

			if err != nil {
				return err
			}
		}
		return nil
	case MappingNode:
		for index := 0; index < len(node.Content); index = index + 2 {
			key := node.Content[index]
			value := node.Content[index+1]
			err := pe.doEncode(w, value, pe.appendPath(path, key.Value))
			if err != nil {
				return err
			}
		}
		return nil
	case AliasNode:
		return pe.doEncode(w, node.Alias, path)
	default:
		return fmt.Errorf("unsupported node %v", node.Tag)
	}
}

func (pe *shellVariablesEncoder) appendPath(cookedPath string, rawKey interface{}) string {

	// Shell variable names must match
	//    [a-zA-Z_]+[a-zA-Z0-9_]*
	//
	// While this is not mandated by POSIX, which is quite lenient, it is
	// what shells (for example busybox ash *) allow in practice.
	//
	// Since yaml names can contain basically any character, we will process them according to these steps:
	//
	//     1. apply unicode compatibility decomposition NFKD (this will convert accented
	//        letters to letters followed by accents, split ligatures, replace exponents
	//        with the corresponding digit, etc.
	//
	//     2. discard non-ASCII characters as well as ASCII control characters (ie. anything

View on GitHub (pinned to 8b5af0694b)

Solutions

  1. Simplify the expression to plain maps/scalars, e.g. `yq -o sv '.' config.yaml` without exotic operators.
  2. Retag or stringify suspicious nodes: `.foo |= (tostring)`.
  3. Preview with `-o json` to spot the offending node shape, then normalize it.
  4. Upgrade yq if the node kind should legitimately be supported.

Example fix

# before
yq -o sv 'custom_op' config.yaml   # produces odd node -> unsupported node

# after
yq -o sv '.' config.yaml
Defensive patterns

Strategy: validation

Validate before calling

yq -o json '.' config.yaml > /dev/null && yq '[kind] ' config.yaml   # inspect kinds before -o sv

Type guard

null

Try / catch

yq -o sv '.' config.yaml || { echo "unsupported node; normalize with tostring/retag"; }

Prevention

When it happens

Trigger: Encoding to `-o shellvariables`/`-o sv` a document whose traversal produces an unhandled Kind — e.g. custom/document nodes created by certain operators — inside doEncode's default branch.

Common situations: Generating env-var exports from YAML configs with unusual tagged values; using expressions that return non-standard nodes before encoding; documents with merge/custom type tags that resolve oddly.

Related errors


AI-assisted analysis of mikefarah/yq@8b5af0694b (2026-09-05). Data as JSON: /api/errors/6ffa4a5e2c0162de. Report an issue: GitHub.