Python repo: unable to find valid certification path to requested target

I try to run de sonar-scanner.bat analyzer over my python repository, but the sonar server is private
I got this error:
Caused by: PKIX path building failed: unable to find valid certification path to requested target

I tried to run this command in Windows.

Also, I can configure the same analyzer but for another project, in this case, a JAVA project. I add the cert.pem file into the Java keystore, but… How can I also add the cert.pem file for this project in python?

Thanks in advance


Welcome to the community!

You’ve correctly diagnosed this as a problem with the certificate, but there’s nothing to import into Python. You need to get it fully imported into your Java trust store. The docs may help.


hello Ann. Thanks for your answer

For my test in the repository with Java, I have added the certificate to the java keystore in windows: “C:\Program Files\Java\jdk-\lib\security\cacerts”

Also, since I work with several versions I have also added it to: “C:\Program Files (x86)\Java\jre-1.8\lib\security\cacerts”.
and also to “C:\Program Files\Java\jdk-\lib\security\cacerts”

Do you think I’m missing something, because I don’t have any other java versions installed on my machine that I know of.

Greetings and thanks again


Is this a self-signed certificate? Did you read the docs I pointed you to? If it’s self-signed, you’ll need to import the full chain.


I followed the “For SonarScanner for Maven, Gradle, or CLI” section.
And added the trustStore and Password options

sonar-scanner.bat -D"sonar.projectKey=python-fon-lib" -D"sonar.sources=." -D"—" -D"sonar.token=–" -D"\repositories\tls-mutual-nginx\cacerts" -D""

I need to do something more? I’m sorry if I’m not seeing clearly


Take a closer look at that documentation I pointed you to. It’s not a parameter on the analysis command line.


Okey, I set the environment variable, but doesn’t work
[System.Environment]::SetEnvironmentVariable(“SONAR_SCANNER_OPTS”, “\repositories\tls-mutual-nginx\cacerts”) ← In windows PS

sonar-scanner.bat -D"sonar.projectKey=python-fon-lib" -D"sonar.sources=." -D"[host]" -D"sonar.token=[token]"


Sorry, but I have nothing to offer here beyond those docs.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.