apache/seatunnel · error · IllegalArgumentException

Option '${option}' cannot be blank

Error message

Option '${option}' cannot be blank

What it means

Thrown by the private helper requireNonBlank in GooglePubSubSourceConfig, called from from() and requireNonBlankIfPresent(). It rejects any mandatory option whose value is null or whitespace-only (e.g. project id, topic, subscription). The exception message names the offending option key so the user can fix it directly.

Source

Thrown at seatunnel-connectors-v2/connector-google-pubsub/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/pubsub/config/GooglePubSubSourceConfig.java:85

        requirePositive(maxOutstandingBytes, GooglePubSubSourceOptions.MAX_OUTSTANDING_BYTES.key());
        requirePositive(parallelPullCount, GooglePubSubSourceOptions.PARALLEL_PULL_COUNT.key());

        return GooglePubSubSourceConfig.builder()
                .projectId(projectId)
                .subscription(subscription)
                .credentialsPath(credentialsPath)
                .emulatorHost(emulatorHost)
                .format(format)
                .fieldDelimiter(fieldDelimiter)
                .maxOutstandingMessages(maxOutstandingMessages)
                .maxOutstandingBytes(maxOutstandingBytes)
                .parallelPullCount(parallelPullCount)
                .build();
    }

    private static void requireNonBlank(String value, String option) {
        if (value == null || value.trim().isEmpty()) {
            throw new IllegalArgumentException("Option '" + option + "' cannot be blank");
        }
    }

    private static void requireNonBlankIfPresent(String value, String option) {
        if (value != null) {
            requireNonBlank(value, option);
        }
    }

    private static void requirePositive(Number value, String option) {
        if (value != null && value.longValue() <= 0) {
            throw new IllegalArgumentException("Option '" + option + "' must be greater than 0");
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set the named option (see the option name in the message) to a non-blank value in the source config.
  2. Check that referenced environment variables (e.g. PUBSUB_PROJECT, PUBSUB_TOPIC) are actually exported in the runtime environment.
  3. Remove the option entirely if it is optional (e.g. credentials_path when using Application Default Credentials) rather than leaving it empty.

Example fix

// before
GooglePubSubSourceOptions.TOPIC.key() -> ""
// after
source {
  GooglePubSub {
    topic = "projects/my-project/topics/my-topic"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

for (String key : List.of("project", "topic", "subscription")) {
    String v = config.get(key);
    if (v == null || v.trim().isEmpty()) {
        throw new IllegalArgumentException("Option '" + key + "' cannot be blank");
    }
}

Prevention

When it happens

Trigger: Building the source config via GooglePubSubSourceConfig.from with a required string option (such as project, topic, or subscription) that is null, "", or contains only spaces; also triggered when an optional option like credentials_path or emulator_host is present but blank.

Common situations: HOCON config omits the topic value, a YAML/props file has topic = with nothing after the equals sign, or an env-var placeholder like ${PUBSUB_TOPIC} expands to empty because the variable is unset.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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