JuliusBrussee/caveman · error

not valid TOON

Error message

not valid TOON

What it means

Error "not valid TOON" thrown in JuliusBrussee/caveman.

Source

Thrown at engine/toon.go:24

	"github.com/JuliusBrussee/caveman/engine/compressors"
)

// EncodeTOON converts JSON to the lossless TOON subset without CCR or size
// gating. It is for explicit agent/CLI requests, not automatic proxy routing.
func (e *Engine) EncodeTOON(input []byte) ([]byte, error) {
	out, ok := compressors.NewTOON().Compress(input)
	if !ok {
		return nil, fmt.Errorf("not losslessly TOON-encodable (invalid JSON, or nested/non-uniform shape); keep JSON")
	}
	return out, nil
}

// DecodeTOON converts TOON back to compact JSON. Malformed TOON fails closed.
func (e *Engine) DecodeTOON(input []byte) ([]byte, error) {
	v, ok := compressors.DecodeTOON(input)
	if !ok {
		return nil, fmt.Errorf("not valid TOON")
	}
	out, err := json.Marshal(v)
	if err != nil {
		return nil, err
	}
	return out, nil
}

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Provide valid TOON input.

When it happens

Trigger: Thrown at engine/toon.go:24 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/88b9f12d91c98bba. Report an issue: GitHub.