Skip to content

Troubleshooting coverage CLI issues#

The sections below provide instructions or workarounds to overcome common issues while using Codacy Coverage Reporter CLI:

Can't guess any report due to no matching#

Codacy Coverage Reporter automatically searches for coverage reports matching the file name conventions for supported formats.

However, if Codacy Coverage Reporter doesn't find your coverage report, you can explicitly define the report file name with the flag -r. For example:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r <coverage report file name>

Can't validate checksum#

Starting on version 13.0.0 the get.sh script automatically validates the checksum of the downloaded Codacy Coverage Reporter binary. This requires having either the sha512sum or shasum command on the operating system where you're running the script.

If you're getting this error while uploading your coverage data to Codacy, install the correct version of sha512sum or shasum for the operating system that you're using.

You can also skip validating the checksum of the binary by defining the following environment variable, however, Codacy doesn't recommend this:

export CODACY_REPORTER_SKIP_CHECKSUM=true

Commit SHA-1 hash detection#

The Codacy Coverage Reporter automatically detects the SHA-1 hash of the current commit to associate with the coverage data when you're using one of the following CI/CD platforms:

  • Appveyor
  • Argo CD
  • AWS CodeBuild
  • Azure Pipelines
  • Bitrise
  • Buildkite
  • Circle CI
  • Codefresh
  • Codeship
  • Docker
  • GitLab
  • Greenhouse CI
  • Heroku CI
  • Jenkins
  • Magnum CI
  • Semaphore CI
  • Shippable CI
  • Solano CI
  • TeamCity CI
  • Travis CI
  • Wercker CI

If the Codacy Coverage Reporter fails to detect the current commit from the CI workflow context, it will use the current commit from the local Git repository instead.

However, you can also force using a specific commit SHA-1 hash with the flag --commit-uuid. For example:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    -r report.xml \
    --commit-uuid cd4d000083a744cf1617d46af4ec108b79e06bed

Connect timed out while uploading coverage data#

If you get a Error doing a post to <...> connect timed out error while uploading your coverage data to Codacy it means that the Codacy Coverage Reporter is timing out while connecting to the Codacy API. This typically happens if you're uploading coverage data for larger repositories.

To increase the default timeout while connecting to the Codacy API, use the flag --http-timeout to set a value larger than 10000 milliseconds. For example, to set the timeout to 30 seconds:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    -r report.xml \
    --http-timeout 30000

coverage-xml/index.xml generated an empty result#

If you're using PHPUnit version 5 or above to generate your coverage report, you must output the report using the Clover format. Codacy Coverage Reporter supports the PHPUnit XML format only for versions 4 and older.

To change the output format replace the flag --coverage-xml <dir> with --coverage-clover <file> when executing phpunit.

See PHPUnit command-line documentation for more information.

JsonParseException while uploading coverage data#

If you get a com.fasterxml.jackson.core.JsonParseException error while uploading your coverage data to Codacy it means that your coverage report is too big and that Codacy Coverage Reporter hit a limit of 10 MB when uploading the coverage data to Codacy.

There are some ways you can solve this:

  • Split your coverage reports into smaller files and upload them to Codacy one at a time.

  • If you're using dotCover to generate coverage reports for your C# projects, you should exclude xUnit files from the coverage analysis as follows:

    dotCover.exe cover <...> /Filters=-:xunit*
    

    By default, dotCover includes xUnit files in the coverage analysis and this results in larger coverage reports. This filter helps ensure that the resulting coverage data doesn't exceed the size limit accepted by the Codacy API when uploading the results.

MalformedInputException while parsing report#

If you get a java.nio.charset.MalformedInputException when running the Codacy Coverage Reporter it means that the coverage report includes a character that's not encoded in UTF-8. The invalid character can belong to the file name of one of your source code files, or even a class or method name.

For maximum compatibility of your coverage reports with the Codacy Coverage Reporter, make sure that your coverage reports use UTF-8 encoding and that they only include UTF-8 characters.

No coverage data was sent#

You can get the No coverage data was sent error when running the Codacy Coverage Reporter for the following reasons:

  • The coverage report doesn't include any coverage data.
  • The coverage report only includes data for files that don't exist in the associated Git repository. In this case, you also get one or more warnings File: [filename] will be discarded and will not be considered for coverage calculation.

Make sure that your coverage report isn't empty and that it includes coverage data for files in the associated Git repository.

Note

If you upload multiple coverage reports and at least one contains valid data, the Codacy Coverage Reporter uploads the valid reports and ignores the invalid ones.

Report generated an empty result while uploading C# coverage data#

If you're using dotCover to generate coverage reports for your C# projects, you must use the dotCover detailedXML report format as follows:

dotCover.exe cover <...> --reportType=DetailedXml

SubstrateSegfaultHandler caught signal 11#

If you're experiencing segmentation faults when uploading the coverage results due to oracle/graal#624, execute the following command before running the reporter, as a workaround:

echo "$(dig +short api.codacy.com | tail -n1) api.codacy.com" >> /etc/hosts

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

Edit this page on GitHub if you notice something wrong or missing.

If you have a question or need help please contact support@codacy.com.

Last modified February 5, 2024