{"record":{"id":"59753eaa9440ac17","repo":"apache/seatunnel","slug":"rabbitmq-07","errorCode":"RABBITMQ-07","errorMessage":"parse uri failed","messagePattern":"parse uri failed","errorType":"error_code","errorClass":"RabbitmqConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-rabbitmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rabbitmq/client/RabbitmqClient.java","lineNumber":108,"sourceCode":"    /**\n     * Create a new QueueingConsumer for the given queue and split.\n     *\n     * @param queue blocking queue\n     * @param splitId split id\n     * @return consumer instance\n     */\n    public DefaultConsumer getQueueingConsumer(\n            BlockingQueue<DeliveryMessage> queue, String splitId) {\n        return new QueueingConsumer(channel, queue, splitId);\n    }\n\n    private ConnectionFactory createConnectionFactory() {\n        ConnectionFactory factory = new ConnectionFactory();\n        if (StringUtils.isNotEmpty(config.getUri())) {\n            try {\n                factory.setUri(config.getUri());\n            } catch (URISyntaxException e) {\n                throw new RabbitmqConnectorException(PARSE_URI_FAILED, e);\n            } catch (KeyManagementException e) {\n                // this should never happen\n                throw new RabbitmqConnectorException(INIT_SSL_CONTEXT_FAILED, e);\n            } catch (NoSuchAlgorithmException e) {\n                // this should never happen\n                throw new RabbitmqConnectorException(SETUP_SSL_FACTORY_FAILED, e);\n            }\n        } else {\n            factory.setHost(config.getHost());\n            factory.setPort(config.getPort());\n            if (StringUtils.isNotEmpty(config.getVirtualHost())) {\n                factory.setVirtualHost(config.getVirtualHost());\n            }\n            factory.setUsername(config.getUsername());\n            factory.setPassword(config.getPassword());\n        }\n\n        if (config.getAutomaticRecovery() != null) {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-rabbitmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rabbitmq/client/RabbitmqClient.java#L90-L126","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nuri=\"amqp://guest:pass#word@localhost:5672/\"   # '#' breaks URI parsing\n// after\nuri=\"amqp://guest:pass%23word@localhost:5672/\" # URL-encode special chars","handlingStrategy":"validation","validationCode":"// validate uri before job submission\nString uri = config.getUri();\nif (uri != null && !uri.isEmpty()) {\n    java.net.URI parsed = new java.net.URI(uri); // throws if malformed\n    if (!parsed.getScheme().equals(\"amqp\") && !parsed.getScheme().equals(\"amqps\")) {\n        throw new IllegalArgumentException(\"uri scheme must be amqp/amqps: \" + uri);\n    }\n    if (parsed.getHost() == null) throw new IllegalArgumentException(\"uri missing host: \" + uri);\n}","typeGuard":"boolean isValidAmqpUri(String uri) {\n    try {\n        java.net.URI u = new java.net.URI(uri);\n        return (\"amqp\".equals(u.getScheme()) || \"amqps\".equals(u.getScheme()))\n                && u.getHost() != null;\n    } catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n    new RabbitmqClient(config, ...);\n} catch (RabbitmqConnectorException e) {\n    if (e.getErrorCode() == RabbitmqConnectorErrorCode.PARSE_URI_FAILED) {\n        LOG.error(\"Invalid RMQ uri in config: {}\", config.getUri(), e.getCause());\n    } else throw e;\n}","preventionTips":["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"],"tags":["rabbitmq","amqp","uri","configuration"],"backgroundTag":"invalid-url-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}