mikefarah/yq · error

unsupported type %v

Error message

unsupported type %v

What it means

decodeNode's switch hit default: the TOML AST node has a Kind the decoder has no handler for (it covers Key, String, Bool, Integer, DateTime, Float, Array, InlineTable). This indicates a construct the yq TOML decoder has not implemented — effectively unsupported TOML syntax rather than malformed input.

Source

Thrown at pkg/yqlib/decoder_toml.go:242

func (dec *tomlDecoder) decodeNode(tomlNode *toml.Node) (*CandidateNode, error) {
	switch tomlNode.Kind {
	case toml.Key, toml.String:
		return dec.createStringScalar(tomlNode)
	case toml.Bool:
		return dec.createBoolScalar(tomlNode)
	case toml.Integer:
		return dec.createIntegerScalar(tomlNode)
	case toml.DateTime:
		return dec.createDateTimeScalar(tomlNode)
	case toml.Float:
		return dec.createFloatScalar(tomlNode)
	case toml.Array:
		return dec.createArray(tomlNode)
	case toml.InlineTable:
		return dec.createInlineTableMap(tomlNode)
	default:
		return nil, fmt.Errorf("unsupported type %v", tomlNode.Kind)
	}

}

func (dec *tomlDecoder) Decode() (*CandidateNode, error) {
	if dec.finished {
		return nil, io.EOF
	}
	//
	// toml library likes to panic
	var deferredError error
	defer func() { //catch or finally
		if r := recover(); r != nil {
			var ok bool
			deferredError, ok = r.(error)
			if !ok {
				deferredError = fmt.Errorf("pkg: %v", r)
			}

View on GitHub (pinned to 8b5af0694b)

Solutions

  1. Identify the construct via the %v kind in the message and restructure it into a supported form (scalars, arrays, inline tables)
  2. Upgrade yq — newer releases may support the node kind
  3. As a workaround, convert the TOML to YAML/JSON externally before processing
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/yqlib/decoder_toml.go:242 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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