mikefarah/yq · error

only keyvalue pairs are supported in inlinetables, got %v in

Error message

only keyvalue pairs are supported in inlinetables, got %v instead

What it means

While walking the children of a TOML inline table (the { ... } form), createInlineTableMap encountered a child node whose Kind is not toml.KeyValue — e.g. a nested table declaration or a stray token. Inline tables in TOML may only contain key/value pairs, so the parsed AST violates that expectation and decoding is aborted.

Source

Thrown at pkg/yqlib/decoder_toml.go:137

		default:
			// run out of key values
			log.Debugf("done in decodeKeyValuesIntoMap, gota a %v", nextItem.Kind)
			return true, nil
		}
	}
	log.Debug("no more things to read in")
	return false, nil
}

func (dec *tomlDecoder) createInlineTableMap(tomlNode *toml.Node) (*CandidateNode, error) {
	content := make([]*CandidateNode, 0)
	log.Debug("createInlineTableMap")

	iterator := tomlNode.Children()
	for iterator.Next() {
		child := iterator.Node()
		if child.Kind != toml.KeyValue {
			return nil, fmt.Errorf("only keyvalue pairs are supported in inlinetables, got %v instead", child.Kind)
		}

		keyValues := &CandidateNode{
			Kind: MappingNode,
			Tag:  "!!map",
		}

		if err := dec.processKeyValueIntoMap(keyValues, child); err != nil {
			return nil, err
		}

		content = append(content, keyValues.Content...)
	}

	return &CandidateNode{
		Kind:       MappingNode,
		Tag:        "!!map",
		EncodeHint: EncodeHintInline,

View on GitHub (pinned to 8b5af0694b)

Solutions

  1. Move nested table syntax out of the inline table into regular [table] sections
  2. Keep inline tables limited to key = value pairs
  3. Check for a missing comma or brace that made the parser attach a non-keyvalue node
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/yqlib/decoder_toml.go:137 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/0e818b11a40aacf9. Report an issue: GitHub.