{"record":{"id":"45b8847a11557399","repo":"apache/seatunnel","slug":"connection-failed-45b884","errorCode":"CONNECTION_FAILED","errorMessage":"Failed to create Google Pub/Sub subscriber for subscription ${subscription}","messagePattern":"Failed to create Google Pub/Sub subscriber for subscription (.+?)","errorType":"error_code","errorClass":"GooglePubSubConnectorException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-google-pubsub/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/pubsub/source/GooglePubSubSubscriber.java","lineNumber":107,"sourceCode":"                                                            .getDefaultServiceScopes())));\n                }\n            }\n\n            Subscriber subscriber = subscriberBuilder.build();\n            subscriber.addListener(\n                    new ApiService.Listener() {\n                        @Override\n                        public void failed(ApiService.State from, Throwable failure) {\n                            failureHandler.accept(failure);\n                        }\n                    },\n                    Runnable::run);\n            return new GooglePubSubSubscriber(subscriber, emulatorChannel);\n        } catch (Exception e) {\n            if (emulatorChannel != null) {\n                emulatorChannel.shutdownNow();\n            }\n            throw new GooglePubSubConnectorException(\n                    GooglePubSubConnectorErrorCode.CONNECTION_FAILED,\n                    \"Failed to create Google Pub/Sub subscriber for subscription \"\n                            + config.getSubscription(),\n                    e);\n        }\n    }\n\n    private static void configureFlowControl(\n            Subscriber.Builder subscriberBuilder, GooglePubSubSourceConfig config) {\n        if (config.getMaxOutstandingMessages() != null || config.getMaxOutstandingBytes() != null) {\n            FlowControlSettings.Builder flowControlSettings =\n                    Subscriber.Builder.getDefaultFlowControlSettings().toBuilder();\n            if (config.getMaxOutstandingMessages() != null) {\n                flowControlSettings.setMaxOutstandingElementCount(\n                        config.getMaxOutstandingMessages());\n            }\n            if (config.getMaxOutstandingBytes() != null) {\n                flowControlSettings.setMaxOutstandingRequestBytes(config.getMaxOutstandingBytes());","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-google-pubsub/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/pubsub/source/GooglePubSubSubscriber.java#L89-L125","documentation":"GooglePubSubSubscriber.create builds a com.google.cloud.pubsub.v1.Subscriber for the configured subscription; if construction fails for any reason the exception is wrapped in GooglePubSubConnectorException(CONNECTION_FAILED) and the emulator channel (if used) is shut down. It means the subscriber client could not be created at all, before any pull was attempted.","triggerScenarios":"Subscriber.newBuilder(...).build() throws — unresolvable host, invalid subscription project path, invalid credentials, or emulator channel setup failure when the emulator is configured.","commonSituations":"Wrong project id or subscription name in HOCON config; missing GOOGLE_APPLICATION_CREDENTIALS; offline/air-gapped environment; malformed emulator host; missing pubsub API enabled on the project.","solutions":["Verify the cause: hostname resolution, credentials, or subscription path","Confirm subscription exists: gcloud pubsub subscriptions describe <name>","Set GOOGLE_APPLICATION_CREDENTIALS to a valid service-account JSON with pubsub.subscriber role","If using the emulator, check PUBSUB_EMULATOR_HOST is reachable","Enable the Cloud Pub/Sub API on the project"],"exampleFix":"// before\nsubscription = \"my-sub\"\n// after\nsubscription = \"projects/my-project/subscriptions/my-sub\"","handlingStrategy":"validation","validationCode":"gcloud pubsub subscriptions describe projects/my-project/subscriptions/my-sub  # run before job\ngcloud auth application-default print-access-token   # verify credentials","typeGuard":null,"tryCatchPattern":"try { GooglePubSubSubscriber.create(config); } catch (GooglePubSubConnectorException e) { log.error(\"subscriber create failed: {}\", e.getCause()); throw e; }","preventionTips":["Validate subscription path format projects/<proj>/subscriptions/<name> before submit","Set GOOGLE_APPLICATION_CREDENTIALS and test with gcloud first","Enable the Pub/Sub API on the project","If using emulator, ping the emulator host first"],"tags":["pubsub","connection","credentials","config"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}