Skip to content
Latchkey

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%.

sonar-scanner
WARN: Coverage report 'coverage.xml' can not be found, ignoring this file
INFO: Python test coverage: 0 files analyzed

Common 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

  1. Run the coverage tool and confirm the output file exists where the property expects it.
  2. List the file before the scanner step so a missing report fails loudly.
  3. Re-run the scan.
Terminal
pytest --cov=src --cov-report=xml:coverage.xml
ls -l coverage.xml
sonar-scanner -Dsonar.python.coverage.reportPaths=coverage.xml

Point 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-project.properties
sonar.python.coverage.reportPaths=reports/coverage-*.xml

How 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.

Frequently asked questions

What causes ""reportPaths ... file can not be found""?
The test step did not run with coverage, so no report file exists for the scanner to import.
How do I fix "reportPaths ... file can not be found"?
Produce the report at the configured path

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card