{"record":{"id":"043143aa67294a15","repo":"apache/beam","slug":"error-decoding-string-field","errorCode":null,"errorMessage":"error decoding string field","messagePattern":"error decoding string field","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/coder/row_decoder.go","lineNumber":220,"sourceCode":"\t\treturn errors.Wrap(err, \"error decoding bool field\")\n\t}\n\trv.SetBool(v)\n\treturn nil\n}\n\nfunc reflectDecodeByte(rv reflect.Value, r io.Reader) error {\n\tb, err := DecodeByte(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error decoding single byte field\")\n\t}\n\trv.SetUint(uint64(b))\n\treturn nil\n}\n\nfunc reflectDecodeString(rv reflect.Value, r io.Reader) error {\n\tv, err := DecodeStringUTF8(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error decoding string field\")\n\t}\n\trv.SetString(v)\n\treturn nil\n}\n\nfunc reflectDecodeInt(rv reflect.Value, r io.Reader) error {\n\tv, err := DecodeVarInt(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error decoding varint field\")\n\t}\n\trv.SetInt(v)\n\treturn nil\n}\n\nfunc reflectDecodeUint(rv reflect.Value, r io.Reader) error {\n\tv, err := DecodeVarUint64(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error decoding varint field\")","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/coder/row_decoder.go#L202-L238","documentation":"Wraps an error from DecodeStringUTF8 while decoding a string field: the length-prefixed UTF-8 string could not be read from the stream. Typically caused by EOF, a bad length prefix, or invalid alignment of the stream.","triggerScenarios":"reflectDecodeString during row decoding when DecodeStringUTF8 fails — truncated data, corrupt length prefix, or decoding bytes not produced by the matching row encoder.","commonSituations":"Reading partial outputs from failed jobs, manually concatenated row blobs, schema drift between writer and reader.","solutions":["Verify the input was produced by the matching Beam row encoder and is not truncated.","Re-encode the source data.","Check schema evolution compatibility (field order/count).","Inspect the bytes at the failure offset for corruption."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := decoderFn(rv, r); err != nil {\n    if strings.Contains(err.Error(), \"error decoding string field\") {\n        return fmt.Errorf(\"bad length-prefixed string in row: %w\", err)\n    }\n    return err\n}","preventionTips":["Ensure string fields are UTF-8 and written by the matching encoder.","Guard against reading partial files (check EOF before batch decode).","Keep schema versions aligned between producing and consuming jobs.","Test decoders against golden fixture blobs."],"tags":["decode-error","string-field","row-decoding","io"],"backgroundTag":"file-read-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}