go
data_error
ai_generated
true
proto: duplicate field "name" in JSON
ID: go/protobuf-json-marshal-duplicate-field
80%Fix Rate
85%Confidence
0Evidence
2025-06-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.x | active | — | — | — |
Root Cause
The JSON input contains the same field more than once, which protojson rejects.
generic中文
JSON 输入中同一字段出现多次,protojson 拒绝解析。
Workarounds
-
90% success
// Validate JSON before sending; use a library that enforces uniqueness.
-
85% success
opts := protojson.UnmarshalOptions{DiscardUnknown: true} err := opts.Unmarshal(data, msg)
Dead Ends
Common approaches that don't work:
-
80% fail
Lenient parsers may not handle protobuf semantics correctly.
-
70% fail
Manual removal is error-prone and not scalable.