mikefarah/yq · error

pkg: %v

Error message

pkg: %v

What it means

Decode installs a recover() because the underlying TOML library panics on some malformed input instead of returning an error. This message is produced when the recovered panic value is not an error type (e.g. a string or runtime error), so it is wrapped as 'pkg: <panic>'. The real fault is a library-level panic during TOML parsing, not a yq check.

Source

Thrown at pkg/yqlib/decoder_toml.go:259

	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)
			}
		}
	}()

	log.Debug("ok here we go")
	var runAgainstCurrentExp = false
	var err error
	for runAgainstCurrentExp || dec.parser.NextExpression() {

		if runAgainstCurrentExp {
			log.Debug("running against current exp")
		}

		currentNode := dec.parser.Expression()

		log.Debugf("currentNode: %v ", currentNode.Kind)
		runAgainstCurrentExp, err = dec.processTopLevelNode(currentNode)
		if err != nil {

View on GitHub (pinned to 8b5af0694b)

Solutions

  1. Fix the TOML input that triggered the library panic (commonly malformed tables, duplicate keys, or invalid values)
  2. Validate the file with another TOML parser (e.g. tomlcheck) to locate the fault
  3. Report the panic upstream to the TOML library if the input appears valid
  4. Try a newer yq/TOML library version where the panic may be fixed
Defensive patterns

Strategy: try-catch

When it happens

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