provectus/kafka-ui · error · ValidationException

Invalid format for webclient.maxInMemoryBufferSize

Error message

Invalid format for webclient.maxInMemoryBufferSize

What it means

WebclientProperties.validateAndSetDefaultBufferSize validates the optional `webclient.maxInMemoryBufferSize` property by attempting DataSize.parse. If the string is not a valid Spring DataSize format (e.g. missing a unit), a ValidationException is thrown at startup.

Solutions

  1. Append a valid size unit, e.g. `webclient.maxInMemoryBufferSize: 10MB`
  2. Use one of B, KB, MB, GB, TB suffixes accepted by Spring's DataSize.parse
  3. Remove the property entirely to fall back to the default buffer size

Example fix

// before
webclient:
  maxInMemoryBufferSize: 5242880
// after
webclient:
  maxInMemoryBufferSize: 5MB
Defensive patterns

Strategy: validation

Validate before calling

import re
v = config.get('webclient', {}).get('maxInMemoryBufferSize')
if v is not None and not re.fullmatch(r'\d+(B|KB|MB|GB|TB)', str(v)):
    raise ValueError(f'Invalid DataSize: {v}')

Try / catch

try:
    DataSize.parse(bufferSize)
except Exception:
    raise ValidationException('Use e.g. 10MB for webclient.maxInMemoryBufferSize')

Prevention

When it happens

Trigger: Setting webclient.maxInMemoryBufferSize in application config to a value like `5242880` (no unit) or `abc`; the value must parse as a DataSize (e.g. `10MB`, `512KB`).

Common situations: Copy-pasting a raw byte count from WebFlux docs without a unit suffix; typos in unit (`10 MBB`); locale-formatted numbers with separators like `5,000,000`.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of provectus/kafka-ui@83b5a60cc0 (2026-09-08). Data as JSON: /api/errors/a6f0c1ce53db29dc. Report an issue: GitHub.

Appendix: source

Thrown at kafka-ui-api/src/main/java/com/provectus/kafka/ui/config/WebclientProperties.java:27

@Configuration
@ConfigurationProperties("webclient")
@Data
public class WebclientProperties {

  String maxInMemoryBufferSize;

  @PostConstruct
  public void validate() {
    validateAndSetDefaultBufferSize();
  }

  private void validateAndSetDefaultBufferSize() {
    if (maxInMemoryBufferSize != null) {
      try {
        DataSize.parse(maxInMemoryBufferSize);
      } catch (Exception e) {
        throw new ValidationException("Invalid format for webclient.maxInMemoryBufferSize");
      }
    }
  }

}

View on GitHub (pinned to 83b5a60cc0)