{"record":{"id":"d7fa70834d8412bb","repo":"apache/beam","slug":"e","errorCode":null,"errorMessage":"e","messagePattern":"e","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreWriteSchemaTransformProvider.java","lineNumber":194,"sourceCode":"      this.schema = schema;\n      this.projectId = projectId;\n      this.databaseId = databaseId;\n      this.collectionId = collectionId;\n      this.documentIdField = documentIdField;\n      this.handleErrors = handleErrors;\n      this.errorSchema = errorSchema;\n    }\n\n    @ProcessElement\n    public void processElement(@Element Row row, MultiOutputReceiver receiver) {\n      try {\n        Document document =\n            FirestoreUtils.rowToDocument(\n                row, schema, projectId, databaseId, collectionId, documentIdField);\n        receiver.get(OUTPUT_TAG).output(Write.newBuilder().setUpdate(document).build());\n      } catch (Exception e) {\n        if (!handleErrors) {\n          throw new RuntimeException(e);\n        }\n        errorCounter.inc();\n        receiver.get(ERROR_TAG).output(ErrorHandling.errorRecord(errorSchema, row, e));\n      }\n    }\n  }\n}\n","sourceCodeStart":176,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreWriteSchemaTransformProvider.java#L176-L202","documentation":"The Firestore write DoFn (FirestoreWriteSchemaTransformProvider) wraps any exception thrown while converting a Beam Row to a Firestore Document (or issuing the write builder) in a RuntimeException and rethrows it, unless error handling ('handleErrors') is enabled. The original cause is preserved as the RuntimeException's cause. This generic wrapper is the control-flow path for any row-to-document failure (bad schema, invalid document id, conversion errors).","triggerScenarios":"processElement calls FirestoreUtils.rowToDocument(row, schema, projectId, databaseId, collectionId, documentIdField) and any exception thrown there (or by Write.newBuilder().setUpdate(...)) when handleErrors is false.","commonSituations":"Input row does not match the configured schema, documentIdField references a missing/null field, or a field value cannot be mapped to a Firestore type. Common in SchemaTransform pipeline configs where the row schema drifted from the FirestoreIO configuration.","solutions":["Inspect the cause of the RuntimeException (e.getCause()) to find the real conversion failure","Verify the incoming Row schema exactly matches the schema configured for the Firestore write transform","If documentIdField is set, confirm every row has a non-null, non-empty value in that field","Enable handleErrors=true to route failing rows to the error output tag instead of failing the pipeline"],"exampleFix":"// before\nPCollection<Row> written = rows.apply(FirestoreIO.v1().write().bulkWrite()\n    .withSchema(rowSchema).withCollectionId(\"c\").buildExpandable());\n// after (route bad rows to error output instead of failing)\nPCollection<Row> written = rows.apply(FirestoreIO.v1().write().bulkWrite()\n    .withSchema(rowSchema).withCollectionId(\"c\")\n    .withErrorHandling(true).buildExpandable());","handlingStrategy":"try-catch","validationCode":"if (row == null || row.getSchema() == null || !row.getSchema().equals(expectedSchema)) {\n  throw new IllegalArgumentException(\"Row schema does not match configured Firestore write schema\");\n}\nif (documentIdField != null && (row.getValue(documentIdField) == null\n    || row.getValue(documentIdField).toString().isEmpty())) {\n  throw new IllegalArgumentException(\"documentIdField value missing in row\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  Document doc = FirestoreUtils.rowToDocument(row, schema, projectId, databaseId, collectionId, documentIdField);\n} catch (RuntimeException e) {\n  // e is a wrapper; inspect root cause\n  Throwable cause = e.getCause();\n  LOG.error(\"Firestore row conversion failed for row: {}\", row, cause);\n}","preventionTips":["Keep the Beam Row schema and the Firestore write schema in lockstep (generate one from the other)","Enable handleErrors=true in production to divert bad rows to the error output tag instead of failing the pipeline","Always log e.getCause() for these wrapper RuntimeExceptions"],"tags":["java","apache-beam","firestore","data-conversion","pipeline-failure"],"backgroundTag":"database-write-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"}