{"record":{"id":"a4816082b91ed4cd","repo":"apache/beam","slug":"firestore-project-id-must-be-set-on-the-transform-or-a48160","errorCode":null,"errorMessage":"Firestore project id must be set on the transform or pipeline options.","messagePattern":"Firestore project id must be set on the transform or pipeline options\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreWriteSchemaTransformProvider.java","lineNumber":145,"sourceCode":"\n      PCollection<Row> errorOutput = outputTuple.get(ERROR_TAG).setRowSchema(errorSchema);\n      ErrorHandling errorHandling = configuration.getErrorHandling();\n      return PCollectionRowTuple.of(\n          (handleErrors && errorHandling != null) ? errorHandling.getOutput() : \"errors\",\n          errorOutput);\n    }\n\n    private String resolveProjectId(org.apache.beam.sdk.Pipeline pipeline) {\n      if (!Strings.isNullOrEmpty(configuration.getProjectId())) {\n        return configuration.getProjectId();\n      }\n      FirestoreOptions firestoreOptions = pipeline.getOptions().as(FirestoreOptions.class);\n      if (!Strings.isNullOrEmpty(firestoreOptions.getFirestoreProject())) {\n        return firestoreOptions.getFirestoreProject();\n      }\n      String project = pipeline.getOptions().as(GcpOptions.class).getProject();\n      if (Strings.isNullOrEmpty(project)) {\n        throw new IllegalArgumentException(\n            \"Firestore project id must be set on the transform or pipeline options.\");\n      }\n      return project;\n    }\n\n    private String resolveDatabaseId(org.apache.beam.sdk.Pipeline pipeline) {\n      if (!Strings.isNullOrEmpty(configuration.getDatabaseId())) {\n        return configuration.getDatabaseId();\n      }\n      return pipeline.getOptions().as(FirestoreOptions.class).getFirestoreDb();\n    }\n  }\n\n  static class RowToWriteFn extends DoFn<Row, Write> {\n    private final Schema schema;\n    private final String projectId;\n    private final String databaseId;\n    private final String collectionId;","sourceCodeStart":127,"sourceCodeEnd":163,"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#L127-L163","documentation":"The Firestore write SchemaTransform needs a GCP project id to address the database. It checks the transform configuration, then FirestoreOptions.getFirestoreProject(), then GcpOptions.getProject(); if all are unset/empty it throws this IllegalArgumentException. The pipeline cannot infer a project from the environment at graph-construction time.","triggerScenarios":"Expanding the Firestore write transform without setting the project id in configuration and without --firestoreProject or --project pipeline options; running where GcpOptions.getProject() was never populated (no --project flag, no GOOGLE_CLOUD_PROJECT resolution at submit time).","commonSituations":"Running pipelines on machines without gcloud-configured default project; CI environments lacking GOOGLE_CLOUD_PROJECT; template runs where the project parameter was omitted.","solutions":["Set the pipeline option --project=<gcp-project-id> (or GOOGLE_CLOUD_PROJECT env var before submit)","Set --firestoreProject=<project-id> to specify the Firestore project explicitly","Pass projectId in the Firestore write configuration/transform builder if the API exposes it","For Dataflow templates, supply the project as a template parameter"],"exampleFix":"// before\npipeline.apply(FirestoreIO.v1().write().bulk().to(\"coll\").build()); // no project anywhere\n// after\n// run with: --project=my-gcp-project  (or)\nPipelineOptions opts = PipelineOptionsFactory.fromArgs(args).withValidation().create();\nopts.as(FirestoreOptions.class).setFirestoreProject(\"my-gcp-project\");","handlingStrategy":"validation","validationCode":"GcpOptions gcp = options.as(GcpOptions.class); if (gcp.getProject() == null || gcp.getProject().isEmpty()) { throw new IllegalArgumentException(\"--project is required\"); }","typeGuard":null,"tryCatchPattern":"try { pipeline.apply(write); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Firestore project id must be set\")) { // surface a clear CLI/config error to the operator } throw e; }","preventionTips":["Always pass --project (or set GOOGLE_CLOUD_PROJECT) in CI and templates","Set FirestoreOptions.setFirestoreProject when multiple projects are in play","Fail fast with a config check at job submission rather than at graph construction"],"tags":["firestore","gcp","configuration","missing-project-id"],"backgroundTag":"missing-required-config-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}