{"record":{"id":"eb6f4232eb430497","repo":"apache/beam","slug":"unable-to-convert-v-to-schema-field","errorCode":null,"errorMessage":"unable to convert %v to schema field","messagePattern":"unable to convert (.+?) to schema field","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go","lineNumber":614,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"unable to convert key of %v to schema field\", ot)\n\t\t}\n\t\tvt, err := r.reflectTypeToFieldType(t.Elem())\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"unable to convert value of %v to schema field\", ot)\n\t\t}\n\t\treturn &pipepb.FieldType{\n\t\t\tTypeInfo: &pipepb.FieldType_MapType{\n\t\t\t\tMapType: &pipepb.MapType{\n\t\t\t\t\tKeyType:   kt,\n\t\t\t\t\tValueType: vt,\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil\n\tcase reflect.Struct:\n\t\tsch, err := r.structToSchema(t)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"unable to convert %v to schema field\", ot)\n\t\t}\n\t\treturn &pipepb.FieldType{\n\t\t\tTypeInfo: &pipepb.FieldType_RowType{\n\t\t\t\tRowType: &pipepb.RowType{\n\t\t\t\t\tSchema: sch,\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil\n\tcase reflect.Slice, reflect.Array:\n\t\t// Special handling for []byte\n\t\tif t == reflectx.ByteSlice {\n\t\t\treturn &pipepb.FieldType{\n\t\t\t\tTypeInfo: &pipepb.FieldType_AtomicType{\n\t\t\t\t\tAtomicType: pipepb.AtomicType_BYTES,\n\t\t\t\t},\n\t\t\t}, nil\n\t\t}\n\t\tvt, err := r.reflectTypeToFieldType(t.Elem())","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go#L596-L632","documentation":"Thrown in reflectTypeToFieldType when a Go struct type cannot be converted to a Beam RowType because r.structToSchema(t) failed. The error wraps the underlying cause (e.g. an embedded/unsupported field, recursion issue, or unregistered logical type) with this message identifying the offending type.","triggerScenarios":"Schema-encoding any Go struct (via beam.Impulse/Pardo schema coders, ToType/FromType, or RegisterLogicalType) where structToSchema returns an error — typically because one of the struct's fields hit reflectTypeToFieldType failure.","commonSituations":"A struct contains an unexported-but-referenced unsupported field kind (chan, func, interface), or a nested struct field of a type that is neither registered nor atomic.","solutions":["Inspect the wrapped error to find which field failed","Remove or replace unsupported fields (interface/func/chan) with concrete schema-convertible types","Register the nested type via schema.RegisterLogicalType or schema.RegisterAssignableType","Flatten or restructure the struct so all fields are schema-representable"],"exampleFix":"// before\ntype Cfg struct { Hooks []func() }\n// after\ntype Cfg struct { HookNames []string }","handlingStrategy":"validation","validationCode":"if err := isSchemaSafe(reflect.TypeOf(MyStruct{})); err != nil {\n  log.Fatalf(\"struct not schema-convertible: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"t, err := schema.FromType(reflect.TypeOf(v))\nif err != nil {\n  return fmt.Errorf(\"cannot schema-encode %T: %w\", v, err)\n}","preventionTips":["Avoid interface{}, func, chan fields in schema-encoded structs","Run a round-trip test (FromType/ToType) per struct in CI","Keep schema-encoded DTOs separate from domain types with behavior"],"tags":["go","apache-beam","schema","struct-conversion"],"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-14T16:17:12.679Z"}