[Azure DevOps, Python] ERROR: java.lang.IllegalArgumentException: No TypeShed symbol

  • ALM used: Azure DevOps
  • CI system used Azure DevOps
  • Scanner command used when applicable: SonarCloudAnalyze@1 for Azure pipelines
  • Languages of the repository: Python
  • Error observed
##[section]Starting: SC| Analize
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarCloud server.
Version      : 1.40.0
Author       : sonarsource
Help         : Version: 1.40.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarcloud-extension-for-azure-devops/)
INFO: Scanner configuration file: /home/vsts/work/_tasks/SonarCloudAnalyze_xxxxx/1.40.0/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/vsts/work/1/s/MY_PROJECT/sonar-project.properties
INFO: SonarScanner
INFO: Java 11.0.19 Eclipse Adoptium (64-bit)
INFO: Linux 5.15.0-1040-azure amd64
INFO: User cache: /home/vsts/.sonar/cache
INFO: Analyzing on SonarCloud
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=119ms
INFO: Server id: xxxx
INFO: User cache: /home/vsts/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=107ms
INFO: Load/download plugins (done) | time=22491ms
INFO: Loaded core extensions: developer-scanner
INFO: Found an active CI vendor: 'Azure DevOps'
INFO: Load project settings for component key: 'MY_PROJECT'
INFO: Load project settings for component key: 'MY_PROJECT' (done) | time=77ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: MY_PROJECT
INFO: Base dir: /home/vsts/work/1/s/MY_PROJECT
2023-06-29T11:44:48.7397724Z INFO: Working dir: /home/vsts/work/1/s/MY_PROJECT/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=114ms
INFO: Check ALM binding of project 'MY_PROJECT'
INFO: Detected project binding: NOT_BOUND
INFO: Check ALM binding of project 'MY_PROJECT' (done) | time=91ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=92ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=1ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=188ms
INFO: Load active rules
INFO: Load active rules (done) | time=2573ms
INFO: Branch name: MY_BRANCH_NAME, type: short-lived
INFO: Load project repositories
INFO: Load project repositories (done) | time=91ms
INFO: SCM collecting changed files in the branch
WARN: Could not find ref: main in refs/heads, refs/remotes/upstream or refs/remotes/origin
INFO: SCM collecting changed files in the branch (done) | time=52ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Included sources: **/*.py
INFO:   Excluded sources: **/build-wrapper-dump.json, **/*.txt, **/*.md, **/*.xlsx, **/*.xlsm
INFO: 8 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: 2 files ignored because of scm ignore settings
INFO: Quality profile for py: Sonar way
INFO: ------------- Run sensors on module MY_PROJECT
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=92ms
INFO: Sensor cache enabled
INFO: Load sensor cache
INFO: Load sensor cache (15 KB) | time=504ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=12ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=2ms
INFO: Sensor TextAndSecretsSensor [text]
INFO: 8 source files to be analyzed
INFO: 8/8 source files have been analyzed
INFO: Sensor TextAndSecretsSensor [text] (done) | time=48ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=13ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: Sensor Python Sensor [python]
INFO: Starting global symbols computation
INFO: 6 source files to be analyzed
INFO: 6/6 source files have been analyzed
INFO: Starting rules execution
INFO: 8 source files to be analyzed
WARN: Unable to analyze file: mock_package/subpackage/module1_2.py
java.lang.IllegalArgumentException: No TypeShed symbol found for name: str
	at org.sonar.python.types.TypeShed.typeShedClass(TypeShed.java:115)
	at org.sonar.python.types.RuntimeType.getTypeClass(RuntimeType.java:142)
	at org.sonar.python.types.RuntimeType.runtimeTypeSymbol(RuntimeType.java:150)
	at com.sonarsource.dbd.frontend.python.A.A.A(na:500)
	at com.sonarsource.dbd.frontend.python.A.A.A(na:3035)
	at com.sonarsource.dbd.frontend.python.A.B.F.A(na:372)
	at com.sonarsource.dbd.frontend.python.A.E.A(na:518)
	at com.sonarsource.dbd.frontend.python.A.B.A.A(na:2240)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at com.sonarsource.dbd.frontend.python.A.B.A.A(na:2808)
	at com.sonarsource.dbd.frontend.python.A.B.A.A(na:1741)
	at com.sonarsource.dbd.frontend.python.A.B.A.A(na:3294)
	at com.sonarsource.dbd.frontend.python.A.E.A(na:518)
	at com.sonarsource.dbd.frontend.python.A.A.L.A(na:1412)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at com.sonarsource.dbd.frontend.python.A.A.L.A(na:1412)
	at com.sonarsource.dbd.frontend.python.A.E.A(na:1540)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at com.sonarsource.dbd.frontend.python.A.A.P.C(na:1825)
	at com.sonarsource.dbd.frontend.python.A.A.P.B(na:3208)
	at com.sonarsource.dbd.frontend.python.A.visitFunctionDef(na:1123)
	at org.sonar.python.tree.FunctionDefImpl.accept(FunctionDefImpl.java:166)
	at org.sonar.plugins.python.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:33)
	at org.sonar.plugins.python.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:40)
	at org.sonar.plugins.python.api.tree.BaseTreeVisitor.visitStatementList(BaseTreeVisitor.java:52)
	at org.sonar.python.tree.StatementListImpl.accept(StatementListImpl.java:46)
 	at org.sonar.plugins.python.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:33)
 	at org.sonar.plugins.python.api.tree.BaseTreeVisitor.visitFileInput(BaseTreeVisitor.java:47)
 	at com.sonarsource.dbd.frontend.python.A.scanFile(na:866)
 	at com.sonarsource.dbd.frontend.python.rules.A.scanFile(na:615)
 	at org.sonar.plugins.python.PythonScanner.scanFile(PythonScanner.java:136)
 	at org.sonar.plugins.python.Scanner.execute(Scanner.java:59)
 	at org.sonar.plugins.python.PythonSensor.execute(PythonSensor.java:118)
 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:48)
 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:66)
 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:48)
 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:470)
 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:466)
 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:422)
 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:130)
 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:57)
 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:51)
 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
 	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
 	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
 	at org.sonarsource.scanner.cli.Main.main(Main.java:62)

# finally it keeps doing so for each analysed file

this above is just a piece, but it actually keeps returning the same error for every file parsed.
We got the first report this morning at 08 UTC.

  • Steps to reproduce: Just launch an Analysis in pipeline
  • Potential workaround: No found so far

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Exactly same issue here. Also AzureDevops. Is it some global SonarCloud bug ?

Hello @gianfaProm and thank you for reporting this problem.

I’m not sure of the exact configuration of your project, but I’ve been able to reproduce these error logs on a different project.

Have you set the sonar.python.version property? If yes, can you tell me to which version?

Also, do the analysis results you get differ in any way from what you would expect (missing issues or false positives)? Or is the impact just pollution of the logs?


here its

Hi @Guillaume, thank you very much for your kind reply

this is my sonar-project.properties




The notable effects found are:

  • no files parsed, as all reported error.
  • despite errors within the azure task, the task completes successfully. This is a problem for us.
  • someone reported that no updates are found in the gui report and (to be furtherr verified) that previous issues have been removed.

Relaunching after making python minor explicit, inspired by your previous comment


It appears that the pipeline reported no more errors. I will check more and confirm about this.

At the same time, it makes me wonder why this sudden change overnight

Same here. I verified ADO pipeline and looks like its explicitly define version of Python to use in workflow:

- task: UsePythonVersion@0
            displayName: "Select Python version"
              versionSpec: "3.9.13"

When I adjusted version property to :

Then issue dissapeared, Thank you !

Thank you @gianfaProm and @kamil_b for the clarification.

This is a new problem, resulting from a change we made in how we resolve semantic information for specific Python versions. Due to this, Python versions that are set to “3” without minor information, as well as all versions that are “3.5” or lower, are affected.

Explicitly setting a Python version that is 3.6 or higher should fix the issue.

We have a ticket for this. Most likely we can release a fix next week.

Thank you all for your cooperation.

@Guillaume_Dequenne it would be greatly appreciated if we could get a communication of these happenings in some way. For example, a header at the beginning of the task saying “WARN: a breaking bug has been reported, we’re working on it: please check here www.blabla” could help us in the company to keep track of what is happening in a timely manner, otherwise several departments end up with a surprise, even though you may already be working on it. This is just a personal opinion hoping to be constructive (you are free to ignore it of course), then you have your own ways of working. Thank you for your readiness to assist us :slight_smile:

I would also add that the problem on issues reporting persists.
I just launched an analysis by voluntarily introducing the not-compliant example proposed in the following rule https://rules.sonarsource.com/python/type/Code%20Smell/RSPEC-6546/.
Unfortunately, I see no trace of it in the code smells.
Please let me know if it sounds familiar to you and if you suggest to open another bug topic eventually.
Thank you again

To be honest, while we were aware of a problem with sonar.python.version, it was much less critical than the one you just reported.

I just made the connection with that issue when investigating the problem you described, and realized the root cause was the same. As a result, I bumped the severity of the ticket and am planning to include it in our next release.

When a breaking bug is discovered, what we tend to do is to roll back to the previous release until a fix is available (which we are considering doing for this problem, by the way), so there’s usually no need for the warning you’re suggesting - but I absolutely agree with your point that transparency is important.

As for the rule you’re referring to, it should only report issues on a sonar.python.version set to be 3.10 or higher, since the feature was not available before (and raising issues would only be noise). If it reports issues for Python versions lower than 3.10, or if it’s not reporting when the version is set to 3.10 and higher, then let me know and I’ll create a ticket to handle this (asking because you said you were using 3.9).

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