apache/seatunnel · critical · IllegalArgumentException

Stripe option 'secret_key' must not be blank

Error message

Stripe option 'secret_key' must not be blank

What it means

StripeSourceParameter.buildWithConfig requires a non-blank 'secret_key' and throws IllegalArgumentException when it is null, empty, or whitespace-only. The key is used as the Bearer credential for Stripe API requests.

Source

Thrown at seatunnel-connectors-v2/connector-http/connector-http-stripe/src/main/java/org/apache/seatunnel/connectors/seatunnel/stripe/source/config/StripeSourceParameter.java:45

import java.util.LinkedHashMap;
import java.util.Map;

public class StripeSourceParameter extends HttpParameter {

    private static final String PAYMENT_INTENTS_PATH = "/v1/payment_intents";
    private static final String AUTHORIZATION = "Authorization";
    private static final String ACCEPT = "Accept";
    private static final String STRIPE_VERSION = "Stripe-Version";

    private int rateLimitMaxRetries;
    private int rateLimitBackoffMs;

    @Override
    public void buildWithConfig(ReadonlyConfig pluginConfig) {
        String secretKey = pluginConfig.get(StripeSourceOptions.SECRET_KEY);
        if (Strings.isNullOrEmpty(secretKey) || secretKey.trim().isEmpty()) {
            throw new IllegalArgumentException("Stripe option 'secret_key' must not be blank");
        }

        String apiBaseUrl = pluginConfig.get(StripeSourceOptions.API_BASE_URL);
        if (Strings.isNullOrEmpty(apiBaseUrl) || apiBaseUrl.trim().isEmpty()) {
            throw new IllegalArgumentException("Stripe option 'api_base_url' must not be blank");
        }

        int pageSize = pluginConfig.get(StripeSourceOptions.PAGE_SIZE);
        if (pageSize < 1 || pageSize > 100) {
            throw new IllegalArgumentException(
                    "Stripe option 'page_size' must be between 1 and 100");
        }

        Long createdGte = pluginConfig.getOptional(StripeSourceOptions.CREATED_GTE).orElse(null);
        Long createdLt = pluginConfig.getOptional(StripeSourceOptions.CREATED_LT).orElse(null);
        if (createdGte != null && createdGte < 0) {
            throw new IllegalArgumentException("Stripe option 'created_gte' must not be negative");
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set 'secret_key' in the source config to a valid Stripe key (sk_live_... / sk_test_...)
  2. If using a variable placeholder, ensure the env var is actually defined and non-empty
  3. Strip accidental whitespace around the key value

Example fix

// before
secret_key = "${STRIPE_SECRET_KEY}"  # env var unset -> empty
// after (env STRIPE_SECRET_KEY=sk_test_51abc...)
secret_key = "${STRIPE_SECRET_KEY}"
Defensive patterns

Strategy: validation

Validate before calling

String key = config.get("secret_key");
if (key == null || key.trim().isEmpty()) {
  throw new IllegalArgumentException("Stripe source requires non-blank 'secret_key'");
}

Try / catch

try { param.buildWithConfig(pluginConfig); } catch (IllegalArgumentException e) {
  if (e.getMessage().contains("secret_key")) { /* set credential and resubmit */ }
}

Prevention

When it happens

Trigger: The job config omits 'secret_key' entirely, sets it to "" or only whitespace, or the config source resolves it to null/empty (e.g. an unset placeholder variable).

Common situations: Placeholder variables like ${STRIPE_SECRET_KEY} not set in the environment; copy-pasting config templates without filling in credentials; key removed during config sanitization.

Understand the failure class

Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.

Related errors


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