vxcontrol/pentagi · error

invalid strings value: expected a JSON array of strings, got

Error message

invalid strings value: expected a JSON array of strings, got: null

What it means

Error "invalid strings value: expected a JSON array of strings, got: null" thrown in vxcontrol/pentagi.

Source

Thrown at backend/pkg/tools/args.go:512

	}
	return s
}

// Strings is a lenient []string for LLM-generated tool-call arguments (e.g.
// the "questions" field of vector-store search tools). Models occasionally
// double-encode the array as a JSON string containing the array literal
// (e.g. "[\"a\", \"b\"]" instead of a real ["a","b"]), which fails a plain
// []string unmarshal with "cannot unmarshal string into ... []string" and
// forces an unnecessary tool-call-fixer round-trip. UnmarshalJSON recovers
// from that case instead of failing outright.
type Strings []string

func (s *Strings) UnmarshalJSON(data []byte) error {
	// A bare JSON "null" unmarshals into a nil slice with no error by default,
	// which would silently mask a required field being omitted - treat it as
	// invalid instead, consistent with Bool/Int64 above.
	if trimmed := strings.TrimSpace(string(data)); trimmed == "null" {
		return fmt.Errorf("invalid strings value: expected a JSON array of strings, got: null")
	}

	// Primary path: a real JSON array of strings - the common, schema-conforming case.
	var arr []string
	if err := json.Unmarshal(data, &arr); err == nil {
		*s = arr
		return nil
	}

	// Recovery path: the array was sent as a JSON string. Try to decode its
	// content as a JSON array of strings first (the double-encoding case seen
	// in production), then fall back to treating the whole string as a single
	// element so one plain question doesn't fail either.
	var encoded string
	if err := json.Unmarshal(data, &encoded); err == nil {
		var nested []string
		if err := json.Unmarshal([]byte(encoded), &nested); err == nil {
			*s = nested

View on GitHub (pinned to ea665308ba)

When it happens

Trigger: Thrown at backend/pkg/tools/args.go:512 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/9e36f0256c00b01d. Report an issue: GitHub.