apache/seatunnel · error · IllegalArgumentException

Option '${option}' cannot be blank

Error message

Option '${option}' cannot be blank

What it means

requireNonBlank() is the shared validator in GooglePubSubSinkConfig that rejects null, empty, or whitespace-only values for mandatory options (projectId, topic, and conditionally credentials_path/emulator_host). It throws IllegalArgumentException naming the offending option key, so blank required options fail fast at sink construction.

Source

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

                    "Options 'credentials_path' and 'emulator_host' cannot be configured together");
        }
        if (format == MessageFormat.TEXT && fieldDelimiter.isEmpty()) {
            throw new IllegalArgumentException("Option 'field_delimiter' cannot be empty");
        }

        return GooglePubSubSinkConfig.builder()
                .projectId(projectId)
                .topic(topic)
                .credentialsPath(credentialsPath)
                .emulatorHost(emulatorHost)
                .format(format)
                .fieldDelimiter(fieldDelimiter)
                .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);
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set the named option (see the message: Option 'X' cannot be blank) to a non-blank value.
  2. If the value comes from an environment variable, export it before job submission or give it a default.
  3. Remove the option entirely if it is optional (requireNonBlankIfPresent only validates when present).

Example fix

// before
topic = "${PUBSUB_TOPIC}"  # env var not set
// after
topic = "my-topic"  # or: export PUBSUB_TOPIC=my-topic
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight check of required options
List<String> required = List.of("project_id", "topic");
for (String key : required) {
  String v = config.getString(key);
  if (v == null || v.trim().isEmpty()) throw new IllegalArgumentException("Option '" + key + "' must be non-blank");
}

Try / catch

try {
  GooglePubSubSinkConfig.from(config);
} catch (IllegalArgumentException e) {
  if (e.getMessage().contains("cannot be blank")) {
    log.error("Provide a value for the option named in: {}", e.getMessage());
  } else throw e;
}

Prevention

When it happens

Trigger: from() calls requireNonBlank (directly or via requireNonBlankIfPresent with a non-null value) and the value is null, "", or whitespace — e.g. project_id missing, topic = "", or credentials_path = " " present but blank.

Common situations: Environment variable placeholders (topic = "${TOPIC}") left unset so they resolve to empty/whitespace; copying a config and deleting the value but keeping the key with empty string; quoting errors producing a blank string.

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/accbffaaad3a9348. Report an issue: GitHub.