go
data_error
ai_generated
true
rpc error: code = InvalidArgument desc = invalid character '}' looking for beginning of object key string
ID: go/grpc-invalid-argument-malformed-json
80%Fix Rate
86%Confidence
0Evidence
2024-06-28First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.3 | active | — | — | — |
Root Cause
The request payload is not valid JSON when using a JSON transcoding gateway or custom unmarshal.
generic中文
使用 JSON 转码网关或自定义反序列化时,请求负载不是有效的 JSON。
Workarounds
-
90% success
if !json.Valid(payload) { return errors.New("invalid JSON") } -
85% success
import "google.golang.org/protobuf/encoding/protojson" // Use protojson.Unmarshal with DiscardUnknown option.
Dead Ends
Common approaches that don't work:
-
60% fail
Printing doesn't fix syntax errors; need proper validation.
-
50% fail
Over-escaping can break valid JSON.