{"record":{"id":"1f8573631d513e2c","repo":"apache/beam","slug":"retrieving-time-data-v","errorCode":null,"errorMessage":"retrieving time data: %v","messagePattern":"retrieving time data: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/encoding.go","lineNumber":292,"sourceCode":"\t\tdata, err := t.MarshalText()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"marshalling time: %v\", err)\n\t\t}\n\t\tif err := coder.EncodeBytes(data, w); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}, nil\n}\n\nfunc timeDec(reflect.Type) (func(io.Reader) (any, error), error) {\n\treturn func(r io.Reader) (any, error) {\n\t\tif err := coder.ReadSimpleRowHeader(1, r); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"decoding time.Time schema override\")\n\t\t}\n\t\tdata, err := coder.DecodeBytes(r)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"retrieving time data: %v\")\n\t\t}\n\t\tt := time.Time{}\n\t\tif err := t.UnmarshalText(data); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"decoding time: %v\")\n\t\t}\n\t\treturn t, nil\n\t}, nil\n}\n","sourceCodeStart":274,"sourceCodeEnd":301,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/encoding.go#L274-L301","documentation":"In the time.Time schema override decoder (sdks/go/pkg/beam/encoding.go), the raw time bytes are extracted with coder.DecodeBytes after the row header. If that length-prefixed byte read fails (truncated stream, bad length prefix), the error is wrapped as \"retrieving time data\". This means the payload bytes of the encoded time.Time could not be read from the stream.","triggerScenarios":"Decoding a schema-encoded time.Time whose length prefix claims more bytes than remain in the stream, or a corrupted length prefix.","commonSituations":"Truncated files/records, data written by a different Beam version with a different bytes encoding, or network/stream interruption mid-record.","solutions":["Re-encode the data with the current Beam SDK version.","Check the wrapped error for truncation (unexpected EOF) and inspect the record length prefix.","Validate record integrity upstream (checksums, complete writes) before decoding.","Fall back to decoding with time.Time.UnmarshalText directly if the data is known to be plain RFC3339 text."],"exampleFix":"// before: blind decode\nv, _ := decodeRecord(raw)\n// after: guard completeness first\nif len(raw) < 2 { return nil, fmt.Errorf(\"record too short for encoded time\") }\nv, err := decodeRecord(raw)\nif err != nil { return nil, fmt.Errorf(\"corrupt time record: %w\", err) }","handlingStrategy":"validation","validationCode":"if len(raw) < 2 { // header + length prefix sanity\n    return fmt.Errorf(\"payload too short for encoded time.Time\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure records are written atomically/completely before decoding","Add checksums on serialized records","Check the wrapped error for unexpected-EOF to detect truncation early"],"tags":["beam","decoding","serialization","truncated-data"],"backgroundTag":"schema-validation-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}