{"record":{"id":"ed411731db7077f9","repo":"apache/beam","slug":"could-not-complete-request","errorCode":null,"errorMessage":"could not complete request","messagePattern":"could not complete request","errorType":"exception","errorClass":"UserCodeExecutionException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/rrio/src/main/java/org/apache/beam/io/requestresponse/Call.java","lineNumber":543,"sourceCode":"      this.caller = caller;\n    }\n\n    private void setExecutor(ExecutorService executor) {\n      this.executor = executor;\n    }\n\n    @Override\n    public ResponseT call(RequestT request) throws UserCodeExecutionException {\n      Future<ResponseT> future = checkStateNotNull(executor).submit(() -> caller.call(request));\n      try {\n        return future.get(timeout.getMillis(), TimeUnit.MILLISECONDS);\n      } catch (TimeoutException | InterruptedException e) {\n        future.cancel(true);\n        throw new UserCodeTimeoutException(e);\n      } catch (ExecutionException e) {\n        parseAndThrow(future, e);\n      }\n      throw new UserCodeExecutionException(\"could not complete request\");\n    }\n  }\n\n  private static class SetupTeardownWithTimeout implements SetupTeardown {\n    private final Duration timeout;\n    private final SetupTeardown setupTeardown;\n    private @MonotonicNonNull ExecutorService executor;\n\n    SetupTeardownWithTimeout(Duration timeout, SetupTeardown setupTeardown) {\n      this.timeout = timeout;\n      this.setupTeardown = setupTeardown;\n    }\n\n    private void setExecutor(ExecutorService executor) {\n      this.executor = executor;\n    }\n\n    @Override","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/rrio/src/main/java/org/apache/beam/io/requestresponse/Call.java#L525-L561","documentation":"CallULike's CallableCall adapter submits the user's PTransform call and waits on a Future. After handling timeout/interruption and ExecutionException, if the future completed without an expected result (e.g. completed exceptionally in an unexpected way or returned nothing), it throws UserCodeExecutionException('could not complete request').","triggerScenarios":"Calling the RequestResponse IO's Call.call where the underlying future finishes without producing a response and without matching the earlier exception branches.","commonSituations":"User Call implementation completing the future abnormally (e.g. returning null/completing with a cancelled state); executor shutdown races; wrapped exception types not matched by parseAndThrow.","solutions":["Inspect the cause chain: enable logging around parseAndThrow to see the original ExecutionException cause.","Ensure your user PTransform's call() always completes the future with a response or a UserCodeExecutionException.","Check that the executor is not shut down / cancelled mid-call (future.cancel races).","Add retry with backoff at the RequestResponseIO level for transient failures."],"exampleFix":"// before\n// user call completes future without setting a response\n// after\nresponseFuture.complete(processBatch(request)); // always complete or completeExceptionally(new UserCodeExecutionException(e))","handlingStrategy":"retry","validationCode":"// Ensure the user call always completes its future before returning\nif (!responseFuture.isDone() && !responseFuture.cancel(false)) { log.warn(\"future left incomplete\"); }","typeGuard":null,"tryCatchPattern":"try { response = call.call(request); } catch (UserCodeExecutionException e) { if (\"could not complete request\".equals(e.getMessage())) { /* retry with backoff, inspect root cause */ } }","preventionTips":["Always complete the future (complete or completeExceptionally) inside your call PTransform.","Keep timeouts generous enough for slow upstreams to finish normally.","Log the underlying ExecutionException cause for real diagnostics."],"tags":["request-response","future","timeout","apache-beam"],"backgroundTag":"request-timeout","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}