{"record":{"id":"8ef5a8812c489f7c","repo":"apache/beam","slug":"firestore-project-id-must-be-set-on-the-transform-or","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/FirestoreReadSchemaTransformProvider.java","lineNumber":165,"sourceCode":"        output =\n            output.and(\n                configuration.getErrorHandling().getOutput(),\n                outputTuple.get(ERROR_TAG).setRowSchema(errorSchema));\n      }\n      return output;\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 DocumentToRowFn extends DoFn<Document, Row> {\n    private final Schema schema;\n    private final @org.checkerframework.checker.nullness.qual.Nullable String documentIdField;\n    private final boolean handleErrors;\n    private final Schema errorSchema;","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreReadSchemaTransformProvider.java#L147-L183","documentation":"The Firestore read transform needs a GCP project id to target. resolveProjectId checks configuration, then FirestoreOptions.getFirestoreProject(), then GcpOptions.getProject(); if all are null/empty it throws IllegalArgumentException because it cannot construct Firestore RPCs without a project.","triggerScenarios":"Creating the read SchemaTransform without a projectId in its configuration while the pipeline options lack both --firestoreProject (or FirestoreOptions.firestoreProject) and --project (GcpOptions.project).","commonSituations":"Running pipelines with only --tempLocation set; local/DirectRunner test runs without GCP options configured; provider config missing the project field; environments relying on ADC that don't pass project via options.","solutions":["Set projectId in the Firestore read SchemaTransform configuration","Pass --project=<gcp-project-id> on the pipeline command line","Set FirestoreOptions: --firestoreProject=<project> (or setFirestoreProject in code)","Verify GcpOptions.getProject() is populated in the runner environment (e.g. Dataflow usually sets it; DirectRunner may not)"],"exampleFix":"// before\nPipeline p = Pipeline.create(); // no --project, no projectId in config\n// after\nPipeline p = Pipeline.create(PipelineOptionsFactory.fromArgs(new String[]{\"--project=my-gcp-project\"}).create());","handlingStrategy":"validation","validationCode":"String project = options.as(GcpOptions.class).getProject();\nif (project == null || project.isEmpty()) {\n  throw new IllegalArgumentException(\"--project must be set for Firestore reads\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  pipeline.apply(firestoreReadTransform);\n} catch (IllegalArgumentException e) {\n  LOG.error(\"Set projectId in config or --project/--firestoreProject options\", e);\n}","preventionTips":["Always pass --project on pipeline launch (works on DirectRunner too)","Or set projectId explicitly in the SchemaTransform configuration","For Firestore-specific override, set --firestoreProject"],"tags":["java","google-cloud-firestore","configuration"],"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"}