Skip to content

[java] Warning logged "Unhandled method connect" during the execution of the tutorial #2291

Closed

Description

@laeubi

I followed the java tutorial and it worked but gives ugly warning in the log what makes one think something is wrong.
As I can't find any connection to the client code itself it seems something inside the SDK itself the user can not influence.

Aug. 07, 2026 7:10:49 AM com.github.copilot.LoggingHelpers logTiming
WARNUNG: JsonRpc.invoke JSON-RPC request finished. Elapsed=PT0.793S, Method=connect, RequestId=1, Status=Failed
java.util.concurrent.CompletionException: com.github.copilot.JsonRpcException: Unhandled method connect
	at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:323)
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:376)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:391)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:657)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:531)
	at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2221)
	at com.github.copilot.JsonRpcClient.handleMessage(JsonRpcClient.java:282)
	at com.github.copilot.JsonRpcClient.lambda$startReader$0(JsonRpcClient.java:257)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
	at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: com.github.copilot.JsonRpcException: Unhandled method connect
	... 7 more

Activity

  1. github-actions commented on Aug 7, 2026

    @github-actions
    Contributor

    Investigation findings

    Files examined: java/src/main/java/com/github/copilot/JsonRpcClient.java and java/src/main/java/com/github/copilot/CopilotClient.java

    Root cause: This is a genuine bug — a misleading WARNING log that fires for an expected, recoverable error.

    Here's what happens:

    1. CopilotClient.verifyProtocolVersion() first tries to call connect on the server.
    2. If the server is a legacy version that doesn't support connect, it throws JsonRpcException: Unhandled method connect.
    3. CopilotClient correctly catches this and falls back to calling ping — the entire flow succeeds.

    However, before the catch in CopilotClient executes, the exceptionally handler in JsonRpcClient.invoke() (line 141-146) unconditionally logs the failure at Level.WARNING:

    }).exceptionally(ex -> {
        LoggingHelpers.logTiming(LOG, Level.WARNING, ex,
                "JsonRpc.invoke JSON-RPC request finished. Elapsed={Elapsed}, Method=" + method + ...
                + ", Status=Failed", timingNanos);
        throw ...;
    });

    This warning fires even when the caller fully expects and handles the failure. The fix would be to either:

    • Log at FINE level in JsonRpcClient.invoke() (let callers decide on severity), or
    • Re-log at FINE level inside CopilotClient when catching the expected connect failure.

    The SDK is working correctly — the fallback to ping succeeds — but the warning is alarming and should be suppressed for this expected case.

    Labeling as bug since the log level is incorrect/misleading for an intentionally handled scenario.

    Generated by Bug Handler for #2291 · sonnet46 27 AIC · ⌖ 5.25 AIC · ⊞ 5.9K · ◷

  2. added 2 commits that reference this issue on Aug 14, 2026
    ddfaecf
    134f55d
  3. SteveSandersonMS commented on Sep 3, 2026

    @SteveSandersonMS
    Contributor

    Closing as not supported — this warning fires only when your CLI predates the SDK's expected protocol version. We only support the SDK paired with its bundled CLI version; mismatched versions (like this one) aren't a supported configuration. See #2310 for the related PR discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions