sipeed/picoclaw · error
syntax error at line , column
Error message
%s syntax error at line %d, column %d: %w
What it means
Same json.SyntaxError path in wrapJSONError but when no preview text can be extracted: the message still reports the exact line and column of the syntax error in the labeled document (e.g. config.json). A pure parse-failure wrapper, not a semantic validation.
Solutions
- Open the file at the reported line/column and fix the JSON syntax
- Run the file through a JSON validator
- Restore the config from backup if editing is risky
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/config/diagnostics.go:79 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/edcabe7822e747c2.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/config/diagnostics.go:79
return prefix + ": " + summary + "\n" + preview
}
func wrapJSONError(data []byte, err error, label string) error {
switch e := err.(type) {
case *json.SyntaxError:
line, column := lineAndColumnForOffset(data, e.Offset)
preview := diagnosticPreviewForOffset(data, e.Offset)
if preview != "" {
return fmt.Errorf(
"%s syntax error at line %d, column %d: %w\n%s",
label,
line,
column,
err,
preview,
)
}
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(View on GitHub (pinned to 49183d7e8d)