sipeed/picoclaw · error

type error at line , column for field : expected but got

Error message

%s type error at line %d, column %d for field %q: expected %s but got %s

What it means

wrapJSONError's json.UnmarshalTypeError variant without preview text: the config value for the named field has the wrong JSON type for the target struct. Reports line, column, field name, expected type, and the offending value.

Solutions

  1. Correct the field's type in config.json to match the expected type in the message
  2. Consult the config schema for valid value shapes
  3. Use the web UI config editor to avoid manual type mistakes
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at pkg/config/diagnostics.go:97 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/a46ece3563562573. Report an issue: GitHub.

Appendix: source

Thrown at pkg/config/diagnostics.go:97

		return fmt.Errorf("%s syntax error at line %d, column %d: %w", label, line, column, err)
	case *json.UnmarshalTypeError:
		line, column := lineAndColumnForOffset(data, e.Offset)
		preview := diagnosticPreviewForOffset(data, e.Offset)
		field := strings.TrimSpace(e.Field)
		if field != "" {
			if preview != "" {
				return fmt.Errorf(
					"%s type error at line %d, column %d for field %q: expected %s but got %s\n%s",
					label,
					line,
					column,
					field,
					e.Type.String(),
					e.Value,
					preview,
				)
			}
			return fmt.Errorf(
				"%s type error at line %d, column %d for field %q: expected %s but got %s",
				label,
				line,
				column,
				field,
				e.Type.String(),
				e.Value,
			)
		}
		if preview != "" {
			return fmt.Errorf(
				"%s type error at line %d, column %d: expected %s but got %s\n%s",
				label,
				line,
				column,
				e.Type.String(),
				e.Value,
				preview,

View on GitHub (pinned to 49183d7e8d)