apache/seatunnel · error · IllegalArgumentException

You haven't enable transaction in Pulsar client.

Error message

You haven't enable transaction in Pulsar client.

What it means

getTcClient casts the PulsarClient to PulsarClientImpl and fetches its TransactionCoordinatorClient. If the client was built without transactions enabled, the coordinator client is null and an IllegalArgumentException is thrown. It signals that transactional features cannot be used because the client lacks a transaction coordinator.

Source

Thrown at seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/PulsarConfigUtil.java:139

        } else {
            throw new PulsarConnectorException(
                    PulsarConnectorErrorCode.PULSAR_AUTHENTICATION_FAILED,
                    "Authentication parameters are required when using authentication plug-in.");
        }
    }

    /**
     * get TransactionCoordinatorClient
     *
     * @param pulsarClient
     * @return
     */
    public static TransactionCoordinatorClient getTcClient(PulsarClient pulsarClient) {
        TransactionCoordinatorClient coordinatorClient =
                ((PulsarClientImpl) pulsarClient).getTcClient();
        // enabled transaction.
        if (coordinatorClient == null) {
            throw new IllegalArgumentException("You haven't enable transaction in Pulsar client.");
        }

        return coordinatorClient;
    }

    /**
     * create transaction
     *
     * @param pulsarClient
     * @param timeout
     * @return
     * @throws PulsarClientException
     * @throws InterruptedException
     * @throws ExecutionException
     */
    public static Transaction getTransaction(PulsarClient pulsarClient, int timeout)
            throws PulsarClientException, InterruptedException, ExecutionException {
        Transaction transaction =

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Enable transactions when building the client: clientBuilder.enableTransaction(true).
  2. Ensure transactions are enabled on the Pulsar broker (transactionCoordinatorEnabled=true).
  3. If transactions are unnecessary, don't request a TC client; use non-transactional send paths instead.

Example fix

// before
PulsarClient client = PulsarClient.builder().serviceUrl(url).create();
TransactionCoordinatorClient tc = PulsarConfigUtil.getTcClient(client);
// after
PulsarClient client = PulsarClient.builder().serviceUrl(url).enableTransaction(true).create();
TransactionCoordinatorClient tc = PulsarConfigUtil.getTcClient(client);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!clientBuilderConf.getOrDefault("enableTransaction", "false").equals("true")) { throw new IllegalStateException("enable transaction before getTcClient"); }

Type guard

if (client instanceof PulsarClientImpl impl && impl.getTcClient() != null) { use(impl.getTcClient()); } else { enableTransactionsAndRebuild(); }

Try / catch

try { tc = PulsarConfigUtil.getTcClient(client); } catch (IllegalArgumentException e) { LOG.error("Transactions disabled on Pulsar client: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling PulsarConfigUtil.getTcClient(pulsarClient) on a client whose builder was not configured with enableTransaction(true); coordinatorClient comes back null.

Common situations: Using transactional Pulsar sink/semantics while the client factory omitted the transactions flag; upgrading code that newly requires transactions but reusing an old client construction path; broker-side transaction coordinator also disabled.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/754a7debab3525af. Report an issue: GitHub.