Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target #480

Open
MomenDev opened this issue Apr 19, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@MomenDev
Copy link

MomenDev commented Apr 19, 2024

What happened?

image
always something wrong with this log, but this custom service can work on other plugin.

Relevant log output or stack trace

javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:378)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:316)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:654)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:473)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:369)
	at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:480)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:458)
	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:201)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1510)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1425)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
	at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379)
	at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209)
	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
	at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
	at java.base/sun.security.validator.Validator.validate(Validator.java:264)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:638)
	... 31 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:148)
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:129)
	at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
	... 36 more

Steps to reproduce

always something wrong with this log

CodeGPT version

2.6.2-222

Operating System

Windows

@MomenDev MomenDev added the bug Something isn't working label Apr 19, 2024
@reneleonhardt
Copy link
Contributor

Did you enable proxy settings?
Could it be that your IntelliJ is very old? Maybe you could try it with the current 2024.1 first?

Otherwise, can you try downloading the certificate (for example with Firefox / Tools / Page Info) and add it to IntelliJ Settings / Tools / Server Certificates?
https://stackoverflow.com/questions/74356366/intellij-ide-giving-pkix-path-building-failed-sun-security-provider-certpath-su#answer-76222569

@MomenDev
Copy link
Author

MomenDev commented Apr 22, 2024

Did you enable proxy settings? Could it be that your IntelliJ is very old? Maybe you could try it with the current 2024.1 first?

I upgrade the IntelliJ version to 2024.1, but but the issue is still happening.

Otherwise, can you try downloading the certificate (for example with Firefox / Tools / Page Info) and add it to IntelliJ Settings / Tools / Server Certificates? https://stackoverflow.com/questions/74356366/intellij-ide-giving-pkix-path-building-failed-sun-security-provider-certpath-su#answer-76222569

I'm not sure which certificate to download. I've tried several possible certificates, but they all fail.

@reneleonhardt
Copy link
Contributor

Does someone have Windows to reproduce this? 😅
CodeGPT 2.6.3 looks a bit different, but there is a valid response with and without API Key.

Bewildcard response

If you want to try you could download an Ubuntu Linux image 🙂
https://ubuntu.com/download/desktop
https://www.virtualbox.org/wiki/Download_Old_Builds_7_0
https://www.jetbrains.com/toolbox-app/

@nmvijay
Copy link

nmvijay commented May 2, 2024

I am facing same issue, is there anyway we can disable cert validation?

@olegatord
Copy link

I've add certificate to IntelliJ Settings / Tools / Server Certificates but anyway have the same issue.

@banalg
Copy link

banalg commented May 18, 2024

Hello, same issue on my side. I use a self signed certificate for testing purposes, and didn't succeed to bypass the certificate validation.

I tried two solutions without success :

  • add the certificate in Intellij (File -> Tools -> Server Certificates)
  • add the certificate in the JRE keystore (%JAVA_HOME%/bin/keytool -importcert -file certificate.cer -keystore keystore.jks -alias "Alias")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants