flowable/flowable-engine · error · FlowableIllegalArgumentException

baseUrl can not be null

Error message

baseUrl can not be null

What it means

RestUrlBuilder.usingBaseUrl throws FlowableIllegalArgumentException when given a null baseUrl. This builder constructs HATEOAS-style resource URLs in REST responses, so a base URL is mandatory to build any resource link.

Source

Thrown at modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/RestUrlBuilder.java:56

    protected RestUrlBuilder() {
    }

    protected RestUrlBuilder(String baseUrl) {
        this.baseUrl = baseUrl;
    }

    public String getBaseUrl() {
        return baseUrl;
    }

    public String buildUrl(String[] fragments, Object... arguments) {
        return new StringBuilder(baseUrl).append("/").append(MessageFormat.format(StringUtils.join(fragments, '/'), arguments)).toString();
    }

    /** Uses baseUrl as the base URL */
    public static RestUrlBuilder usingBaseUrl(String baseUrl) {
        if (baseUrl == null) {
            throw new FlowableIllegalArgumentException("baseUrl can not be null");
        }
        if (baseUrl.endsWith("/")) {
            baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
        }
        return new RestUrlBuilder(baseUrl);
    }

    /** Extracts the base URL from the request */
    public static RestUrlBuilder fromRequest(HttpServletRequest request) {
        return usingBaseUrl(ServletUriComponentsBuilder.fromServletMapping(request).build().toUriString());
    }

    /** Extracts the base URL from current request */
    public static RestUrlBuilder fromCurrentRequest() {
        return usingBaseUrl(ServletUriComponentsBuilder.fromCurrentServletMapping().build().toUriString());
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a non-null baseUrl string to usingBaseUrl, e.g. 'http://localhost:8080/flowable-event-registry-rest'
  2. Ensure fromRequest/fromCurrentRequest is only invoked with a real HttpServletRequest that has a request URL
  3. Check proxy configuration (X-Forwarded-Host / ForwardedFilter) so the base URL can be reconstructed

Example fix

// before
RestUrlBuilder builder = RestUrlBuilder.usingBaseUrl(config.getBaseUrl()); // null
// after
if (config.getBaseUrl() == null) { config.setBaseUrl("http://localhost:8080/flowable-event-registry-rest"); }
RestUrlBuilder builder = RestUrlBuilder.usingBaseUrl(config.getBaseUrl());
Defensive patterns

Strategy: validation

Validate before calling

if (baseUrl == null || baseUrl.isBlank()) {
    throw new IllegalArgumentException("baseUrl must be set before building REST resource URLs");
}

Type guard

boolean hasBaseUrl = b -> b != null && !b.isBlank();

Try / catch

try {
    RestUrlBuilder builder = RestUrlBuilder.usingBaseUrl(baseUrl);
} catch (FlowableIllegalArgumentException e) {
    logger.error("baseUrl not provided: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling RestUrlBuilder.usingBaseUrl(null) directly, or via fromRequest/fromCurrentRequest when the incoming request carries no usable base URL (e.g. unusual or synthetic request context with null request URL).

Common situations: Programmatic use of RestUrlBuilder in tests or custom endpoints passing null; reverse-proxy setups stripping the host so the request URL cannot be reconstructed; calling URL-building code outside an active HTTP request.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/82583af771002a90. Report an issue: GitHub.