unable to find valid certification path to requested target
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
Please avoid AI slops, be concise, and focus on what matters for this issue.
Describe the bug
When using ECA with my company's custom provider, I encountered this issue. My ECA works fine with providers such as DeepSeek. However, my colleagues can use the same custom provider with agents such as Open Code without any problem. I have seen a similar issue. I tried Open JDK 24 & 26, but both yields the same error.
{:exception #error {
:cause unable to find valid certification path to requested target
:via
[{:type javax.net.ssl.SSLHandshakeException
:message (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
:at [jdk.internal.net.http.HttpClientImpl send HttpClientImpl.java 928]}
{:type javax.net.ssl.SSLHandshakeException
:message (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
:at [sun.security.ssl.Alert createSSLException Alert.java 130]}
{:type sun.security.validator.ValidatorException
:message PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
:at [sun.security.validator.PKIXValidator doBuild PKIXValidator.java 387]}
{:type sun.security.provider.certpath.SunCertPathBuilderException
:message unable to find valid certification path to requested target
:at [sun.security.provider.certpath.SunCertPathBuilder build SunCertPathBuilder.java 148]}]
:trace
[[sun.security.provider.certpath.SunCertPathBuilder build SunCertPathBuilder.java 148]
[sun.security.provider.certpath.SunCertPathBuilder engineBuild SunCertPathBuilder.java 129]
[java.security.cert.CertPathBuilder build CertPathBuilder.java 295]
[sun.security.validator.PKIXValidator doBuild PKIXValidator.java 382]
[sun.security.validator.PKIXValidator engineValidate PKIXValidator.java 270]
[sun.security.validator.Validator validate Validator.java 256]
[sun.security.ssl.X509TrustManagerImpl checkTrusted X509TrustManagerImpl.java 284]
[sun.security.ssl.X509TrustManagerImpl checkServerTrusted X509TrustManagerImpl.java 144]
[sun.security.ssl.CertificateMessage$T12CertificateConsumer checkServerCerts CertificateMessage.java 629]
[sun.security.ssl.CertificateMessage$T12CertificateConsumer onCertificate CertificateMessage.java 471]
[sun.security.ssl.CertificateMessage$T12CertificateConsumer consume CertificateMessage.java 367]
[sun.security.ssl.SSLHandshake consume SSLHandshake.java 393]
[sun.security.ssl.HandshakeContext dispatch HandshakeContext.java 476]
[sun.security.ssl.SSLEngineImpl$DelegatedTask run SSLEngineImpl.java 1207]
[java.util.ArrayList forEach ArrayList.java 1604]
[jdk.internal.net.http.common.SSLFlowDelegate lambda$executeTasks$0 SSLFlowDelegate.java 1148]
[jdk.internal.net.http.HttpClientImpl$DelegatingExecutor execute HttpClientImpl.java 168]
[jdk.internal.net.http.common.SSLFlowDelegate executeTasks SSLFlowDelegate.java 1143]
[jdk.internal.net.http.common.SSLFlowDelegate doHandshake SSLFlowDelegate.java 1109]
[jdk.internal.net.http.common.SSLFlowDelegate$Reader processData SSLFlowDelegate.java 508]
[jdk.internal.net.http.common.SSLFlowDelegate$Reader$ReaderDownstreamPusher run SSLFlowDelegate.java 283]
[jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask run SequentialScheduler.java 182]
[jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask run SequentialScheduler.java 149]
[jdk.internal.net.http.common.SequentialScheduler$SchedulableTask run SequentialScheduler.java 207]
[java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1095]
[java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 619]
[java.lang.Thread runWith Thread.java 1460]
[java.lang.Thread run Thread.java 1447]
[com.oracle.svm.core.thread.PlatformThreads threadStartRoutine PlatformThreads.java 832]
[com.oracle.svm.core.thread.PlatformThreads threadStartRoutine PlatformThreads.java 808]]}, :message Connection error: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}
To Reproduce
Since this error only occurs with our custom provider, I do not think you can reproduce it.
Expected behavior
I am using Emacs with ECA, the client says that the (LLM) server is overloaded and I can not get any output. Basically, I just want to use ECA with our custom provider.
Doctor
Paste the relevant parts of /doctor command from chat if applicable:
ECA version: 0.133.1
Server cmd:
Workspaces: C:\Users\Administrator\.config\eca
Default model: deepseek/deepseek-v4-flash (API key (sk-**********033))
Logged providers: None
Relevant env vars:
MICROSOFT_WINDOWSAPPRUNTIME_BASE_DIRECTORY=C:\Program Files\WindowsApps\Microsoft.CommandPalette_0.10.11181.0_x64__8wekyb3d8bbwe\
Credential files: None found
Screenshots If applicable, add screenshots to help explain your problem.
Additional context
I am not sure how this problem gets fixed. Since most of my colleagues uses other agents, our custom provider may not be willing to adjust their server settings. On the other hand, since ECA works with DeepSeek and other major providers, I understand that you may not want to fix this on your side as well.
@drcxd hum interesting, what's your provider exact config (/config can help)?
@drcxd I believe to make the custom provider work for you, you need to specify your custom provider CA certificate, eca allows that via network config here, or env vars like SSL_CERT_FILE.
Maybe your machine has that env but your client (emacs or other) is not spawning eca with that env, you can check with getenv for eamcs for example
@ericdallo After I add the certificate, I still get the same error. Here is my config file:
{
"network": {
"caCertFile": "E:\\cert.pem"
},
"providers": {
"deepseek": {
"api": "openai-chat",
"url": "https://api.deepseek.com",
"key": "--------------------------"
},
"custom-provider": {
"api": "openai-chat",
"url": "------------------",
"models": {
"custom-model": {}
},
"key": "---------------------------"
}
}
}
The certificate file has the following content:
-----BEGIN CERTIFICATE-----
....
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
....
-----END CERTIFICATE-----
The stderr buffer does not provide more information than the certification error. In fact, I did not see any information about reading that certification file.
@drcxd found a bug in eca not respecting always the certifiate settings, did a fix in latest release, can you try again?
@ericdallo Thanks. I have tested with the latest release and now it works.