{"record":{"id":"4ab7954b75a56335","repo":"apache/seatunnel","slug":"failed-to-open-bigquerycatalog","errorCode":null,"errorMessage":"Failed to open BigQueryCatalog","messagePattern":"Failed to open BigQueryCatalog","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-bigquery/src/main/java/org/apache/seatunnel/connectors/bigquery/catalog/BigQueryCatalog.java","lineNumber":101,"sourceCode":"     * @param config the readonly configuration options containing BigQuery connection info\n     */\n    public BigQueryCatalog(String catalogName, ReadonlyConfig config) {\n        this.catalogName = catalogName;\n        this.config = config;\n    }\n\n    /**\n     * Opens the catalog and initializes the BigQuery client.\n     *\n     * @throws CatalogException if the BigQuery client fails to initialize\n     */\n    @Override\n    public void open() throws CatalogException {\n        try {\n            this.bigquery = BigQueryClientFactory.getBigQuery(config);\n            log.info(\"BigQueryCatalog '{}' opened successfully.\", catalogName);\n        } catch (Exception e) {\n            throw new CatalogException(\"Failed to open BigQueryCatalog\", e);\n        }\n    }\n\n    /**\n     * Closes the catalog.\n     *\n     * @throws CatalogException if any resources fail to close\n     */\n    @Override\n    public void close() throws CatalogException {\n        // BigQuery service client doesn't hold open TCP sockets directly; it's a stateless HTTP\n        // wrapper.\n        log.info(\"BigQueryCatalog '{}' closed successfully.\", catalogName);\n    }\n\n    /**\n     * Returns the catalog name.\n     *","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-bigquery/src/main/java/org/apache/seatunnel/connectors/bigquery/catalog/BigQueryCatalog.java#L83-L119","documentation":"BigQueryCatalog.open() initializes the BigQuery client via BigQueryClientFactory.getBigQuery(config). Any exception during client construction (credentials, project, transport) is wrapped into a CatalogException with a generic message; the real cause is in the attached exception.","triggerScenarios":"Calling catalog.open() when Google Cloud credentials are missing/invalid, the service account lacks BigQuery permissions, the project id is wrong, or the BigQuery client factory cannot build the transport client.","commonSituations":"GOOGLE_APPLICATION_CREDENTIALS not set on worker nodes; service-account JSON path wrong or key revoked; no BigQuery API enabled on the project; network/proxy blocking googleapis.com; missing scopes on the credentials.","solutions":["Read the cause of the CatalogException for the concrete failure (credentials, quota, DNS)","Set `GOOGLE_APPLICATION_CREDENTIALS` to a valid service-account JSON and ensure it exists on all worker nodes","Enable the BigQuery API on the project and grant the service account BigQuery roles (e.g. Data Viewer/Editor)","Confirm the project id in the config matches the GCP project and that googleapis.com is reachable"],"exampleFix":"// before (no credentials configured, client init fails)\ncatalog {\n  factory = \"BigQuery\"\n  project = \"my-gcp-project\"\n}\n// after\ncatalog {\n  factory = \"BigQuery\"\n  project = \"my-gcp-project\"\n}\n// plus on the environment:\n// export GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa-key.json","handlingStrategy":"try-catch","validationCode":"// pre-check credentials and project before opening the catalog\nString creds = System.getenv(\"GOOGLE_APPLICATION_CREDENTIALS\");\nif (creds == null || !new java.io.File(creds).exists()) {\n    throw new IllegalStateException(\"GOOGLE_APPLICATION_CREDENTIALS not set or file missing\");\n}\n// also verify BigQuery API enabled: gcloud services list --enabled | grep bigquery","typeGuard":null,"tryCatchPattern":"try {\n    catalog.open();\n} catch (CatalogException e) {\n    log.error(\"BigQuery catalog open failed; root cause:\", e.getCause());\n    // distinguish auth failure vs network vs project misconfiguration\n}","preventionTips":["Ensure GOOGLE_APPLICATION_CREDENTIALS points to a valid, non-revoked service-account key on every node","Enable the BigQuery API and grant the SA BigQuery Data Viewer/Editor roles","Verify project id and outbound access to bigquery.googleapis.com:443"],"tags":["bigquery","gcp","credentials","initialization"],"backgroundTag":"missing-credentials","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}