quarkusio/quarkus · error · WebSocketClientException

Unable to obtain the config value for:

Error message

Unable to obtain the config value for: 

What it means

When the WebSocket client endpoint has no programmatic base URI and no per-client quarkus.websocket.<client-id>.base-uri config property is set, WebSocketConnectorImpl.connect() fails while resolving the server endpoint URI and throws this WebSocketClientException naming the config key.

Source

Thrown at extensions/websockets-next/runtime/src/main/java/io/quarkus/websockets/next/runtime/WebSocketConnectorImpl.java:74

        setPath(clientEndpoint.path);
    }

    @Override
    public Uni<WebSocketClientConnection> connect() {
        // A new client is created for each connection
        // The client is created when the returned Uni is subscribed
        // The client is closed when the connection is closed
        AtomicReference<WebSocketClient> client = new AtomicReference<>();

        StringBuilder serverEndpoint = new StringBuilder();
        if (baseUri != null) {
            serverEndpoint.append(baseUri.toString());
        } else {
            // Obtain the base URI from the config
            String key = clientEndpoint.clientId + ".base-uri";
            Optional<String> maybeBaseUri = ConfigProvider.getConfig().getOptionalValue(key, String.class);
            if (maybeBaseUri.isEmpty()) {
                throw new WebSocketClientException("Unable to obtain the config value for: " + key);
            }
            serverEndpoint.append(maybeBaseUri.get());
        }
        serverEndpoint.append(replacePathParameters(clientEndpoint.path));

        URI serverEndpointUri;
        try {
            serverEndpointUri = new URI(serverEndpoint.toString());
        } catch (URISyntaxException e) {
            throw new WebSocketClientException(e);
        }

        WebSocketConnectOptions connectOptions = newConnectOptions(serverEndpointUri);
        StringBuilder uri = new StringBuilder();
        if (serverEndpointUri.getPath() != null) {
            uri.append(serverEndpointUri.getRawPath());
        }
        if (serverEndpointUri.getQuery() != null) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add quarkus.websocket.<client-id>.base-uri=ws://host:port to application.properties (client-id matches @WebSocketClient clientId or endpoint class-derived id)
  2. Call baseUri(URI) on the connector programmatically before connect()
  3. Verify the client-id used in the property key is correct
  4. Check the property is present in the active profile (e.g. %test)

Example fix

// before
connector.connect(); // no base-uri configured
// after (application.properties)
quarkus.websocket.my-client.base-uri=ws://localhost:8080
// or programmatically
connector.baseUri(URI.create("ws://localhost:8080")).connect();
Defensive patterns

Strategy: validation

Validate before calling

String key = clientId + ".base-uri";
boolean configured = ConfigProvider.getConfig().getOptionalValue(key, String.class).isPresent();
// or check programmatically before connect(); otherwise call connector.baseUri(...)

Try / catch

try {
    connector.connect();
} catch (WebSocketClientException e) {
    if (e.getMessage().contains(".base-uri")) {
        log.error("Set {} in application.properties or call baseUri()", clientId + ".base-uri", e);
    }
}

Prevention

When it happens

Trigger: Calling connect() on a WebSocketConnector for an endpoint that (a) had no baseUri() call on the connector and (b) has no quarkus.websocket.<client-id>.base-uri property in application.properties/yaml — including wrong client-id in the key or property not visible at runtime.

Common situations: Missing application.properties entry; client-id mismatch between annotation and config key; config not included in the build (wrong profile, missing file); test profile lacking the property.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/684d4bbf229308dc. Report an issue: GitHub.