SonarScanner "sonar.python.coverage.reportPaths ... file not found" in CI
The scanner looked for the coverage report at the exact path in sonar.python.coverage.reportPaths and no file exists there. Either tests did not produce it, or it lives at a different path or in another directory.
What this error means
The scan log warns "Coverage report can not be found, ignoring this file" for the configured sonar.python.coverage.reportPaths, and coverage is reported as 0%.
WARN: Coverage report 'coverage.xml' can not be found, ignoring this file
INFO: Python test coverage: 0 files analyzedCommon causes
The report was never generated before the scan
The test step did not run with coverage, so no report file exists for the scanner to import.
The report is at a different path than configured
The coverage tool wrote the report elsewhere (a subdirectory, a different filename) so the configured path misses it.
How to fix it
Produce the report at the configured path
- Run the coverage tool and confirm the output file exists where the property expects it.
- List the file before the scanner step so a missing report fails loudly.
- Re-run the scan.
pytest --cov=src --cov-report=xml:coverage.xml
ls -l coverage.xml
sonar-scanner -Dsonar.python.coverage.reportPaths=coverage.xmlPoint the property at the real report location
If the report is written to a subdirectory, set the property to that path (globs are supported).
sonar.python.coverage.reportPaths=reports/coverage-*.xmlHow to prevent it
- Run tests with coverage before the scanner in the same job.
- Keep the report path property in sync with where coverage writes.
- Assert the report exists before scanning so failures are obvious.