apache/seatunnel · error · IllegalArgumentException
reconnect_timeout must be greater than 0, got: ${reconnectTi
Error message
reconnect_timeout must be greater than 0, got: ${reconnectTimeout} What it means
MqttSourceConfig.validate throws IllegalArgumentException when reconnect_timeout is zero or negative. The value controls how long the source waits before attempting a reconnect after a lost MQTT connection, so it must be a positive duration. Validation fails fast at source construction.
Source
Thrown at seatunnel-connectors-v2/connector-mqtt/src/main/java/org/apache/seatunnel/connectors/seatunnel/mqtt/source/MqttSourceConfig.java:77
"client_id is required when clean_session=false for MQTT source");
}
this.clientId =
isBlank(configuredClientId)
? CLIENT_ID_PREFIX + UUID.randomUUID().toString()
: configuredClientId;
validate();
}
private void validate() {
if (qos < 0 || qos > 1) {
throw new IllegalArgumentException("MQTT source qos must be 0 or 1, got: " + qos);
}
if (!"json".equalsIgnoreCase(format) && !"text".equalsIgnoreCase(format)) {
throw new IllegalArgumentException("Unsupported MQTT source format: " + format);
}
if (reconnectTimeout <= 0) {
throw new IllegalArgumentException(
"reconnect_timeout must be greater than 0, got: " + reconnectTimeout);
}
if (maxQueueSize <= 0) {
throw new IllegalArgumentException(
"max_queue_size must be greater than 0, got: " + maxQueueSize);
}
}
private static boolean isBlank(String value) {
return value == null || value.trim().isEmpty();
}
public String getUrl() {
return url;
}
public String getTopic() {
return topic;View on GitHub (pinned to cf67b549a7)
Solutions
- Set reconnect_timeout to a positive value in the expected unit (e.g. 5000 for 5s if ms)
- Do not attempt to disable reconnection via this option — set it to a sane retry interval instead
- Verify units against MqttSourceOptions.RECONNECT_TIMEOUT definition in docs
Example fix
// before
Mqtt {
reconnect_timeout = 0
}
// after
Mqtt {
reconnect_timeout = 5000
} Defensive patterns
Strategy: validation
Validate before calling
if (reconnectTimeout <= 0) {
throw new IllegalArgumentException("reconnect_timeout must be > 0, got: " + reconnectTimeout);
} Type guard
null
Try / catch
null
Prevention
- Verify the time unit documented for reconnect_timeout before setting it
- Never use 0 or negatives to 'disable' reconnection
- Replace placeholder values in copied templates
When it happens
Trigger: Setting reconnect_timeout = 0 or a negative number in the MQTT source config; also caused by unit mistakes (passing milliseconds where seconds expected, or vice versa, producing 0 after truncation).
Common situations: Copy-paste of option names with wrong units; users trying to 'disable' reconnection by setting 0 (not permitted); template configs with placeholder 0 values never replaced.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- client_id is required when clean_session=false for MQTT sour
- MQTT source qos must be 0 or 1, got: ${qos}
- Unsupported MQTT source format: ${format}
- max_queue_size must be greater than 0, got: ${maxQueueSize}
- Schema config can not be empty
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/b1762bf60f2e9a61.
Report an issue: GitHub.