{"record":{"id":"f1ab50457ab5479e","repo":"apache/beam","slug":"inputted-schema-caused-mutation-error-check-error-logs-and","errorCode":null,"errorMessage":"Inputted Schema caused mutation error, check error logs and input schema format","messagePattern":"Inputted Schema caused mutation error, check error logs and input schema format","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProvider.java","lineNumber":227,"sourceCode":"                + \"\\\"column_qualifier\\\": ByteString\\n\"\n                + \"\\\"family_name\\\": String\\n\"\n                + \"\\\"timestamp_micros\\\": Long\\n\"\n                + \"\\\"start_timestamp_micros\\\": Long\\n\"\n                + \"\\\"end_timestamp_micros\\\": Long\\n\"\n                + \"\\nOR\\n\"\n                + \"\\n\"\n                + \"\\\"key\\\": ByteString\\n\"\n                + \"(\\\"mutations\\\", contains map(String, ByteString) of mutations in the mutation schema format\");\n      }\n\n      if (bigtableMutations != null) {\n        bigtableMutations.apply(\n            BigtableIO.write()\n                .withTableId(configuration.getTableId())\n                .withInstanceId(configuration.getInstanceId())\n                .withProjectId(configuration.getProjectId()));\n      } else {\n        throw new RuntimeException(\n            \"Inputted Schema caused mutation error, check error logs and input schema format\");\n      }\n      return PCollectionRowTuple.empty(input.getPipeline());\n    }\n\n    private void validateField(Schema inputSchema, String field, Schema.TypeName expectedType) {\n      Schema.TypeName actualType = inputSchema.getField(field).getType().getTypeName();\n      checkState(\n          actualType.equals(expectedType),\n          \"Schema field '%s' should be of type %s, but was %s.\",\n          field,\n          expectedType,\n          actualType);\n    }\n\n    public PCollection<KV<ByteString, Iterable<Mutation>>> changeMutationInput(\n        PCollectionRowTuple inputR) {\n      PCollection<Row> beamRowMutationsList = inputR.getSinglePCollection();","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableWriteSchemaTransformProvider.java#L209-L245","documentation":"BigtableWriteSchemaTransformProvider.expand sets bigtableMutations via changeMutationInput, which can return null when the input rows fail mutation conversion (a per-row error was logged upstream). If the resulting value is null, expand throws this RuntimeException telling the user to check the error logs and the schema format.","triggerScenarios":"Applying the Bigtable write schema transform where one or more input rows have invalid mutation data (bad 'type' value, missing required fields), causing changeMutationInput to fail overall and return null.","commonSituations":"Upstream data producing rows whose 'type' field isn't one of SetCell/DeleteFamily/DeleteColumn/DeleteRow; malformed timestamps or missing family_name in a batch of rows.","solutions":["Read the error logs emitted during changeMutationInput to find which rows/fields failed","Fix the input rows' schema/values to conform to the mutation schema format","Pre-validate the 'type' values in your data before applying the transform","Filter or transform bad records upstream before feeding the Bigtable transform"],"exampleFix":"// before\nPCollection<Row> rows = readRows(); // some rows have type=null\nrows.apply(BigtableWriteSchemaTransformProvider...) // throws\n// after\nPCollection<Row> rows = readRows()\n    .apply(Filter.by(r -> r.getString(\"type\") != null));","handlingStrategy":"validation","validationCode":"boolean allRowsValid(PCollection<Row> rows) {\n  return rows.apply(Filter.by(r -> r.getString(\"type\") != null\n      && Set.of(\"SetCell\",\"DeleteFamily\",\"DeleteColumn\",\"DeleteRow\")\n           .contains(r.getString(\"type\")))) != null;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter out or repair invalid mutation rows upstream before the transform","Check error logs emitted during conversion to locate failing rows","Keep a dead-letter output for rejected records"],"tags":["gcp","bigtable","schema","mutation"],"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"}