apache/seatunnel · error · RabbitmqConnectorException
RABBITMQ-07
RABBITMQ-07
Error message
parse uri failed
What it means
RabbitmqClient.createConnectionFactory sets the broker URI on the com.rabbitmq.client.ConnectionFactory when a uri is configured. If the URI is syntactically invalid, factory.setUri throws URISyntaxException, which is wrapped in RabbitmqConnectorException with PARSE_URI_FAILED ('parse uri failed'). Note the original exception does not include the offending URI text, so check the config value.
Source
Thrown at seatunnel-connectors-v2/connector-rabbitmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rabbitmq/client/RabbitmqClient.java:108
/**
* Create a new QueueingConsumer for the given queue and split.
*
* @param queue blocking queue
* @param splitId split id
* @return consumer instance
*/
public DefaultConsumer getQueueingConsumer(
BlockingQueue<DeliveryMessage> queue, String splitId) {
return new QueueingConsumer(channel, queue, splitId);
}
private ConnectionFactory createConnectionFactory() {
ConnectionFactory factory = new ConnectionFactory();
if (StringUtils.isNotEmpty(config.getUri())) {
try {
factory.setUri(config.getUri());
} catch (URISyntaxException e) {
throw new RabbitmqConnectorException(PARSE_URI_FAILED, e);
} catch (KeyManagementException e) {
// this should never happen
throw new RabbitmqConnectorException(INIT_SSL_CONTEXT_FAILED, e);
} catch (NoSuchAlgorithmException e) {
// this should never happen
throw new RabbitmqConnectorException(SETUP_SSL_FACTORY_FAILED, e);
}
} else {
factory.setHost(config.getHost());
factory.setPort(config.getPort());
if (StringUtils.isNotEmpty(config.getVirtualHost())) {
factory.setVirtualHost(config.getVirtualHost());
}
factory.setUsername(config.getUsername());
factory.setPassword(config.getPassword());
}
if (config.getAutomaticRecovery() != null) {View on GitHub (pinned to cf67b549a7)
Solutions
- Fix the uri option to a valid AMQP URI, e.g. amqp://user:pass@host:5672/vhost (URL-encode special characters in the password)
- If it must start with amqps://, ensure port 5671 and valid TLS setup
- As a workaround, drop uri and configure host/port/username/password/virtualHost fields instead (createConnectionFactory's else branch)
- Validate the URI in code with new URI(...) before submitting the job to catch it early
Example fix
// before uri="amqp://guest:pass#word@localhost:5672/" # '#' breaks URI parsing // after uri="amqp://guest:pass%23word@localhost:5672/" # URL-encode special chars
Defensive patterns
Strategy: validation
Validate before calling
// validate uri before job submission
String uri = config.getUri();
if (uri != null && !uri.isEmpty()) {
java.net.URI parsed = new java.net.URI(uri); // throws if malformed
if (!parsed.getScheme().equals("amqp") && !parsed.getScheme().equals("amqps")) {
throw new IllegalArgumentException("uri scheme must be amqp/amqps: " + uri);
}
if (parsed.getHost() == null) throw new IllegalArgumentException("uri missing host: " + uri);
} Type guard
boolean isValidAmqpUri(String uri) {
try {
java.net.URI u = new java.net.URI(uri);
return ("amqp".equals(u.getScheme()) || "amqps".equals(u.getScheme()))
&& u.getHost() != null;
} catch (Exception e) { return false; }
} Try / catch
try {
new RabbitmqClient(config, ...);
} catch (RabbitmqConnectorException e) {
if (e.getErrorCode() == RabbitmqConnectorErrorCode.PARSE_URI_FAILED) {
LOG.error("Invalid RMQ uri in config: {}", config.getUri(), e.getCause());
} else throw e;
} Prevention
- Always include the amqp:// or amqps:// scheme in the uri option
- URL-encode special characters in username/password (e.g. # -> %23, @ -> %40)
- Prefer explicit host/port/username/password/virtualHost fields over uri when possible
- Dry-run URI parsing locally (new URI(value)) before deploying the job
When it happens
Trigger: Source/sink config has a non-empty uri option whose value is not a valid AMQP URI (bad scheme, missing host, illegal characters, invalid port) — factory.setUri(config.getUri()) throws URISyntaxException in createConnectionFactory during client construction.
Common situations: Missing amqp:// or amqps:// scheme prefix; unencoded special characters (@, :, /) in username/password; trailing slashes or typos like amqp://host:port/extra; password containing reserved chars that need URL-encoding.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/59753eaa9440ac17.
Report an issue: GitHub.