{"record":{"id":"7e9559b9a4640ae8","repo":"spring-projects/spring-ai","slug":"failed-to-create-sse-transport-for-connection-co","errorCode":null,"errorMessage":"Failed to create SSE transport for connection '<connectionName>'. Check URL splitting: url='<baseUrl>', sse-endpoint='<sseEndpoint>'. Full URL should be split as: url=http://host:port, sse-endpoint=/path/to/endpoint","messagePattern":"Failed to create SSE transport for connection '<connectionName>'\\. Check URL splitting: url='<baseUrl>', sse-endpoint='<sseEndpoint>'\\. Full URL should be split as: url=http://host:port, sse-endpoint=/path/to/endpoint","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-httpclient/src/main/java/org/springframework/ai/mcp/client/httpclient/autoconfigure/SseHttpClientTransportAutoConfiguration.java","lineNumber":132,"sourceCode":"\t\t\tif (baseUrl == null || baseUrl.trim().isEmpty()) {\n\t\t\t\tthrow new IllegalArgumentException(\"SSE connection '\" + connectionName\n\t\t\t\t\t\t+ \"' requires a 'url' property. Example: url: http://localhost:3000\");\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tvar transportBuilder = HttpClientSseClientTransport.builder(baseUrl)\n\t\t\t\t\t.sseEndpoint(sseEndpoint)\n\t\t\t\t\t.clientBuilder(HttpClient.newBuilder())\n\t\t\t\t\t.jsonMapper(new JacksonMcpJsonMapper(jsonMapper));\n\n\t\t\t\tfor (McpClientCustomizer<HttpClientSseClientTransport.Builder> customizer : transportCustomizers) {\n\t\t\t\t\tcustomizer.customize(connectionName, transportBuilder);\n\t\t\t\t}\n\n\t\t\t\tsseTransports.add(new NamedClientMcpTransport(connectionName, transportBuilder.build()));\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tthrow new IllegalArgumentException(\"Failed to create SSE transport for connection '\" + connectionName\n\t\t\t\t\t\t+ \"'. Check URL splitting: url='\" + baseUrl + \"', sse-endpoint='\" + sseEndpoint\n\t\t\t\t\t\t+ \"'. Full URL should be split as: url=http://host:port, sse-endpoint=/path/to/endpoint\", e);\n\t\t\t}\n\t\t}\n\n\t\treturn sseTransports;\n\t}\n\n}\n","sourceCodeStart":114,"sourceCodeEnd":142,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/auto-configurations/mcp/spring-ai-autoconfigure-mcp-client-httpclient/src/main/java/org/springframework/ai/mcp/client/httpclient/autoconfigure/SseHttpClientTransportAutoConfiguration.java#L114-L142","documentation":"Spring AI's HttpClient-based MCP SSE client transport factory wraps any exception raised while building the SseHttpClientTransport for a named connection in this IllegalArgumentException. The message deliberately reminds the user that the MCP client connection properties split the endpoint into a base 'url' (scheme+host+port) and a separate 'sse-endpoint' path; if those are wrong (malformed URL, missing scheme, wrong split, unreachable host) builder.build() fails and this error is thrown. It chains the underlying cause for diagnosis.","triggerScenarios":"Calling the sseHttpClientTransports @Bean method when spring.ai.mcp.client.sse.connections.<name>.url is malformed (e.g. includes the path, lacks scheme, or points to a non-resolvable host) or sse-endpoint is not a valid path, so that HttpClientTransport.Builder.build() or the customizer throws.","commonSituations":"Putting the full SSE endpoint URL (http://host:port/sse) into 'url' instead of splitting it into url=http://host:port and sse-endpoint=/sse; typos in the connection name properties; Docker/Kubernetes service names not resolvable from the app; trailing slashes or missing http:// scheme.","solutions":["Split the URL correctly: set url=http://host:port and sse-endpoint=/path/to/endpoint (e.g. url=http://localhost:3000, sse-endpoint=/sse).","Verify the base URL includes the http:// or https:// scheme and no path portion.","Check that the MCP server host/port is reachable and the endpoint path matches what the server exposes.","Inspect the chained cause exception for the precise transport failure (DNS, connection refused, URI syntax)."],"exampleFix":"// before\nspring.ai.mcp.client.sse.connections.weather.url=http://localhost:3000/sse\n// after\nspring.ai.mcp.client.sse.connections.weather.url=http://localhost:3000\nspring.ai.mcp.client.sse.connections.weather.sse-endpoint=/sse","handlingStrategy":"validation","validationCode":"String url = env.getProperty(\"spring.ai.mcp.client.sse.connections.weather.url\");\nString sse = env.getProperty(\"spring.ai.mcp.client.sse.connections.weather.sse-endpoint\");\nif (url == null || !url.matches(\"https?://[^/]+\")) throw new IllegalStateException(\"url must be scheme://host:port with no path\");\nif (sse == null || !sse.startsWith(\"/\")) throw new IllegalStateException(\"sse-endpoint must start with /\");","typeGuard":null,"tryCatchPattern":"try {\n    transports = sseHttpClientTransports(...);\n} catch (IllegalArgumentException e) {\n    logger.error(\"MCP SSE transport failed for {}: cause={}\", connName, e.getCause());\n    throw e;\n}","preventionTips":["Always split MCP SSE URLs: base url without path, endpoint path in sse-endpoint.","Smoke-test the MCP server URL with curl before wiring it into config.","Keep connection properties in one reviewed config section to catch malformed URLs early."],"tags":["mcp","sse","configuration","url"],"backgroundTag":"invalid-url-format","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}