{"record":{"id":"c2405160dd69f6d4","repo":"apache/beam","slug":"encoding-v-expected-q","errorCode":null,"errorMessage":"encoding %v, expected: %q","messagePattern":"encoding (.+?), expected: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/coder/row_encoder.go","lineNumber":350,"sourceCode":"\t}\n\n\treturn func(rv reflect.Value, w io.Writer) error {\n\t\tif err := writeRowHeader(rv, w); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor i, f := range coder.fields {\n\t\t\trvf := rv.Field(i)\n\t\t\tswitch rvf.Kind() {\n\t\t\tcase reflect.Ptr, reflect.Map, reflect.Slice:\n\t\t\t\tif rvf.IsNil() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif f.addr {\n\t\t\t\trvf = rvf.Addr()\n\t\t\t}\n\t\t\tif err := f.encode(rvf, w); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"encoding %v, expected: %q\", rvf.Type(), coder.debug[i])\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}, nil\n}\n","sourceCodeStart":332,"sourceCodeEnd":356,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/coder/row_encoder.go#L332-L356","documentation":"Wrap added by the reflective row encoder's per-field loop: the encode function for field i failed, and the message records the field's Go type plus the expected schema field description from coder.debug. This pinpoints which struct field of the row could not be serialized, with the underlying cause (e.g. failed inner encode) wrapped inside.","triggerScenarios":"During row encoding of any struct/slice element, when a field encoder (e.g. nested bytes/struct writer) returns an error such as short writes or unsupported nested value.","commonSituations":"Underlying writer failing mid-row (closed writer, disk full), or nested field coder errors surfaced during pipeline execution.","solutions":["Inspect the wrapped cause for the root writer/encode failure","Check that the destination writer is open and writable throughout the encode","Verify nested field values are encodable (no nil or unsupported values in nested containers)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := enc.Encode(v, w); err != nil {\n    log.Printf(\"row encode failed at field (see wrapped cause): %v\", err)\n    return err\n}","preventionTips":["Keep writers open and healthy for the duration of encoding","Test encode of representative values including nested containers","Check wrapped cause chains to identify the failing field type"],"tags":["go","beam","encoding","serialization"],"backgroundTag":"json-marshal-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}