{"record":{"id":"86e3321d6897d9b6","repo":"apache/beam","slug":"invalid-bigtableio-mutation-s","errorCode":null,"errorMessage":"invalid bigtableio.Mutation: %s","messagePattern":"invalid bigtableio\\.Mutation: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/bigtableio/bigtable.go","lineNumber":169,"sourceCode":"\tf.table = f.client.Open(f.TableName)\n\treturn nil\n}\n\nfunc (f *writeFn) Teardown() error {\n\tif err := f.client.Close(); err != nil {\n\t\treturn fmt.Errorf(\"could not close data operations client: %v\", err)\n\t}\n\treturn nil\n}\n\nfunc (f *writeFn) ProcessElement(ctx context.Context, key int, values func(*Mutation) bool) error {\n\n\tvar mutation Mutation\n\tfor values(&mutation) {\n\n\t\terr := validateMutation(mutation)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid bigtableio.Mutation: %s\", err)\n\t\t}\n\n\t\terr = f.table.Apply(ctx, mutation.RowKey, getBigtableMutation(mutation))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not apply mutation for row key='%s': %v\", mutation.RowKey, err)\n\t\t}\n\n\t}\n\n\treturn nil\n}\n\ntype writeBatchFn struct {\n\t// Project is the project\n\tProject string `json:\"project\"`\n\t// InstanceID is the bigtable instanceID\n\tInstanceID string `json:\"instanceId\"`\n\t// Client is the bigtable.Client","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/bigtableio/bigtable.go#L151-L187","documentation":"Before applying each Mutation to Bigtable, writeFn.ProcessElement calls validateMutation; any validation failure (e.g. empty row key, missing column family, invalid column/value combination) is wrapped as \"invalid bigtableio.Mutation\" with the row key context in the underlying message.","triggerScenarios":"Emitting a bigtableio.Mutation with invalid contents — commonly an empty RowKey, empty ColumnFamily, or an empty Column qualifier — into the PCollection passed to bigtableio.Write/WriteBatch.","commonSituations":"Source records with missing/blank keys being mapped straight into Mutations; column family name mismatch with the table's schema; DoFn producing default-constructed Mutation values on empty input.","solutions":["Read the wrapped validateMutation message to see which field is invalid and the offending row key.","Filter or skip records with empty/invalid row keys before building Mutations.","Ensure ColumnFamily matches a family defined on the target Bigtable table.","Add unit tests mirroring TestMustNotBeBigtableioMutation-style validation for your DoFn output."],"exampleFix":"// before\nfunc toMutation(k string, v []byte) bigtableio.Mutation {\n    return bigtableio.Mutation{RowKey: k, ...}\n}\n// after\nfunc toMutation(k string, v []byte) (bigtableio.Mutation, error) {\n    if k == \"\" {\n        return bigtableio.Mutation{}, nil // skip\n    }\n    return bigtableio.Mutation{RowKey: k, ...}, nil\n}","handlingStrategy":"validation","validationCode":"func validMutation(m bigtableio.Mutation) bool {\n    return m.RowKey != \"\" && m.ColumnFamily != \"\" && m.Column != \"\"\n}","typeGuard":"func isValidMutation(m bigtableio.Mutation) bool {\n    return validateMutation(m) == nil\n}","tryCatchPattern":"if err := writeResult(ctx); err != nil && strings.Contains(err.Error(), \"invalid bigtableio.Mutation\") {\n    // surface row key from message; fix producing DoFn\n}","preventionTips":["Filter records with empty row keys before mapping to Mutations.","Confirm column family names exist on the target table schema.","Unit-test your DoFn output against validateMutation rules."],"tags":["bigtable","validation","beam","go"],"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-14T21:17:11.552Z"}