apache/beam · error · RuntimeException

Could not process the expansion request: + request

Error message

Could not process the expansion request: + request

What it means

Final fallback in ExpansionService.processExpand: thrown when no expansion service attempt threw an exception, yet none produced a usable expansion response, and no aggregated error response was assembled. Indicates the request was never successfully processed but the failure mode is unknown.

Source

Thrown at sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/ExpansionService.java:205

            expansionServiceClientFactory.getExpansionServiceClient(endpoint).expand(request);
        if (!response.getError().isEmpty()) {
          errorResponses.put(endpoint.getUrl(), response);
          continue;
        }
        return response;
      } catch (RuntimeException e) {
        lastException = e;
      }
    }
    if (lastException != null) {
      throw new RuntimeException("Expansion request to transform service failed.", lastException);
    }
    if (!errorResponses.isEmpty()) {
      return getAggregatedErrorResponse(errorResponses);
    } else if (lastException != null) {
      throw new RuntimeException("Expansion request to transform service failed.", lastException);
    } else {
      throw new RuntimeException("Could not process the expansion request: " + request);
    }
  }

  ExpansionApi.DiscoverSchemaTransformResponse processDiscover(
      ExpansionApi.DiscoverSchemaTransformRequest request) {
    // Trying out expansion services and aggregating all successful results.
    // If all services fail, return the last successful response any.
    // If there are no successful responses, re-raises the last error.
    List<ExpansionApi.DiscoverSchemaTransformResponse> successfulResponses = new ArrayList<>();
    ExpansionApi.DiscoverSchemaTransformResponse lastErrorResponse = null;
    for (Endpoints.ApiServiceDescriptor endpoint : endpoints) {
      try {
        ExpansionApi.DiscoverSchemaTransformResponse response =
            expansionServiceClientFactory.getExpansionServiceClient(endpoint).discover(request);
        if (response.getError().isEmpty()) {
          successfulResponses.add(response);
        } else {
          lastErrorResponse = response;

View on GitHub (pinned to 12126d8942)

Solutions

  1. Check the message's request dump for the transform URN and payload being requested.
  2. Verify the transform URN/schema is supported by the configured expansion services.
  3. Confirm the expansion services in the config are the correct ones for the transform being expanded.
  4. Enable debug logging on the ExpansionService client to see individual service responses.

Example fix

// before
throw new RuntimeException("Could not process the expansion request: " + request);
// after
throw new RuntimeException(
    "No expansion service could process the request (urn=" + request + "). "
    + "Check that the configured services support this transform.");
Defensive patterns

Strategy: validation

Validate before calling

// validate the transform URN is one your expansion services support before expanding
Set<String> supported = Set.of("beam:schematransform:...", ...);
if (!supported.contains(transformUrn)) {
  throw new IllegalArgumentException("Unsupported transform URN: " + transformUrn);
}

Try / catch

try {
  expansionResult = expansionService.expand(request);
} catch (RuntimeException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("Could not process the expansion request")) {
    LOG.error("No expansion service recognized the request: {}", request);
  }
  throw e;
}

Prevention

When it happens

Trigger: processExpand loops over all configured expansion services, each returns without exception but without a valid expansion (e.g. empty/unmatched response), leaving errorResponses empty and lastException null.

Common situations: Malformed request built by the client; service silently returning an empty result; config pointing at services that do not recognize the transform URN.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/1aea50e04acc9a56. Report an issue: GitHub.