apache/beam · critical
err
Error message
err
What it means
bigtableio.Write panics when the input PCollection's element type is not bigtableio.Mutation. mustBeBigtableioMutation checks col.Type().Type() and returns an error when the element type differs; Write immediately panics with that error because the connector can only write Bigtable mutations.
Solutions
- Transform the input PCollection so each element is a *bigtableio.Mutation (use a beam.ParDo that builds Mutations from your data).
- Guard before calling: verify reflect.TypeOf(bigtableio.Mutation{}) is assignable from col.Type().Type().
- Use bigtableio.NewMutation(rowKey, family, column, value, timestamp) helpers to construct elements.
Example fix
// before
bigtableio.Write(s, proj, inst, table, beam.Create(s, "row1"))
// after
mut := beam.ParDo(s, func(key string) *bigtableio.Mutation {
return bigtableio.NewMutation(key, "cf", "col", []byte("v"), bigtableio.ServerTimestamp)
}, beam.Create(s, "row1"))
bigtableio.Write(s, proj, inst, table, mut) Defensive patterns
Strategy: type-guard
Validate before calling
if col.Type().Type() != reflect.TypeOf((*bigtableio.Mutation)(nil)).Elem() {
return fmt.Errorf("bigtableio.Write requires PCollection<bigtableio.Mutation>, got %v", col.Type().Type())
} Type guard
func isMutationCol(col beam.PCollection) bool {
return col.Type().Type() == reflect.TypeOf((*bigtableio.Mutation)(nil)).Elem()
} Try / catch
defer func() {
if r := recover(); r != nil {
log.Fatalf("bigtable write setup failed: %v", r)
}
}() Prevention
- Always map source data to *bigtableio.Mutation before Write.
- Keep a shared DoFn for building mutations from your domain types.
- Check element type when connecting different IO stages.
When it happens
Trigger: Calling bigtableio.Write(s, project, instanceID, table, col) where col's element type is a raw string, []byte, custom struct, or any type other than bigtableio.Mutation.
Common situations: Passing a PCollection of row keys or plain values straight into Write without first converting them to Mutation via bigtableio.NewMutation; wiring up a pipeline copied from another IO connector's example.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- Nested FullValues must be nested as pointers.
- pcollection must be of KV type
- pcollection must be of non-composite type
- pubsubio.Write only accepts PCollections of
- received unknown value type: want a number:, got %T
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/feca7fec9a7ca6f0.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/io/bigtableio/bigtable.go:79
// analogue to bigtable.Mutation.Set().
// The timestamp will be truncated to millisecond granularity.
// A timestamp of ServerTime means to use the server timestamp.
func (m *Mutation) Set(family, column string, ts bigtable.Timestamp, value []byte) {
m.Ops = append(m.Ops, Operation{Family: family, Column: column, Ts: ts, Value: value})
}
// WithGroupKey sets a custom group key to be utilised by beam.GroupByKey.
func (m *Mutation) WithGroupKey(key string) *Mutation {
m.GroupKey = key
return m
}
// Write writes the elements of the given PCollection<bigtableio.Mutation> to bigtable.
func Write(s beam.Scope, project, instanceID, table string, col beam.PCollection) {
t := col.Type().Type()
err := mustBeBigtableioMutation(t)
if err != nil {
panic(err)
}
s = s.Scope("bigtable.Write")
pre := beam.ParDo(s, addGroupKeyFn, col)
post := beam.GroupByKey(s, pre)
beam.ParDo0(s, &writeFn{Project: project, InstanceID: instanceID, TableName: table, Type: beam.EncodedType{T: t}}, post)
}
// WriteBatch writes the elements of the given PCollection<bigtableio.Mutation>
// to bigtable using bigtable.ApplyBulk().
// For the underlying bigtable.ApplyBulk function to work properly
// the maximum number of operations per bigtableio.Mutation of the input
// PCollection must not be greater than 100,000. For more information
// see https://cloud.google.com/bigtable/docs/writes#batch for more.
func WriteBatch(s beam.Scope, project, instanceID, table string, col beam.PCollection) {
t := col.Type().Type()
err := mustBeBigtableioMutation(t)View on GitHub (pinned to 12126d8942)