vxcontrol/pentagi · error

invalid string value: got null

Error message

invalid string value: got null

What it means

Error "invalid string value: got null" thrown in vxcontrol/pentagi.

Source

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

// UnmarshalJSON into the 12-character Go string `"write_file"` (quotes
// included), which then matches no known enum value, fails validation, and
// forces an unnecessary tool-call-fixer round-trip. UnmarshalJSON unwraps
// that redundant quoting instead of failing outright.
//
// FileOp, BrowserAction, SubtaskOperationType, and FlowStatusDetail are type
// aliases for String (not distinct types), so every field declared with one
// of those names gets this leniency automatically, with zero changes needed
// at any existing call site: switches, `==` comparisons, and assignments
// against their constants all keep working exactly as before, because the
// alias makes them the exact same type as String, not merely a similar one.
type String string

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

	var raw string
	if err := json.Unmarshal(data, &raw); err != nil {
		return err
	}
	*s = String(unwrapRedundantQuotes(raw))
	return nil
}

func (s String) MarshalJSON() ([]byte, error) {
	return json.Marshal(string(s))
}

// String implements fmt.Stringer, so %s/%v formatting and logrus fields show
// the unwrapped value, and callers that need a plain string (map keys,
// strings.* helpers, external struct fields, typed casts) can call it explicitly.
func (s String) String() string {

View on GitHub (pinned to ea665308ba)

When it happens

Trigger: Thrown at backend/pkg/tools/args.go:461 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/2ab123eba947e8eb. Report an issue: GitHub.