sipeed/picoclaw · error

type error at line , column : expected but got \n

Error message

%s type error at line %d, column %d: expected %s but got %s\n%s

What it means

wrapJSONError's type-error branch when the field name is empty but a preview exists: JSON at the reported position has a value of the wrong type for the target struct and the decoder could not attribute it to a named field. Includes line/column, expected vs actual type, and a source preview.

Solutions

  1. Inspect the shown preview and fix the value's type at the reported line/column
  2. Compare the surrounding JSON block against the documented schema
  3. Validate the whole file with a schema-aware linter
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at pkg/config/diagnostics.go:108 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/259dfee4f01d23d9. Report an issue: GitHub.

Appendix: source

Thrown at pkg/config/diagnostics.go:108

					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,
			)
		}
		return fmt.Errorf(
			"%s type error at line %d, column %d: expected %s but got %s",
			label,
			line,
			column,
			e.Type.String(),
			e.Value,
		)
	default:

View on GitHub (pinned to 49183d7e8d)