Cannot upload to codecov after upgrade to 0.2.8 codecov-ruby gem


Cannot upload to codecov using bash or CircleCI integration. Upload was working prior to upgrade to 0.2.8, forced because the old version of the gem was yanked. Bash upload was not attempted prior to this upgrade. FWIW, when I catch the s3 link before it expires, I get a bad signature error:

<Message>The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.</Message>
<StringToSign>AWS4-HMAC-SHA256 20200825T210637Z 20200825/US/s3/aws4_request 9659cf192fd48f05eea588eec6315f05125b08adf1f3a72b041e794308ac1464</StringToSign>
<CanonicalRequest>GET /codecov/v4/raw/2020-08-25/173FB0B63EE4AA9D7A802BC2222A0FA6/f0cb8dbb48b106864893f7e2181021d40a0b0b76/63cdbd10-8270-4d5f-ac51-ab393ea09b96.txt X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EQX6OZVJGHKK3633AAFGLBUCOOATRACRQRQF6HMSMLYUP6EAD6XSWAAY%2F20200825%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20200825T210637Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host host UNSIGNED-PAYLOAD</CanonicalRequest>






CircleCI orb and bash uploader

Commit SHAs

Ex a879d0df0ab64feb85df77469d3761b90c32177e

Codecov YAML

Not using

Codecov Output

#!/bin/bash -eo pipefail
curl -s | bash -s –
-f “coverage/.resultset.json”
-F “”
-Z || echo ‘Codecov upload failed’

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/

==> Circle CI detected.
    project root: .
    Yaml not found, that's ok! Learn more at
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + coverage/.resultset.json bytes=199649
==> Appending adjustments
    + Found adjustments
==> Gzipping contents
==> Uploading reports
    query: branch=fix%2Fcodecov-experiment&commit=b91ef056db7b5a81078cee9db648b9bc583ba583&build=2921&build_url=&name=2921&tag=&slug=majority-labs%2Ffuture-majority&service=circleci&flags=&pr=&job=0&cmd_args=f,t,n,F,Z
->  Pinging Codecov,t,n,F,Z
->  Uploading to
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  102k    0     0  100  102k      0   258k --:--:-- --:--:-- --:--:--  259k
    -> View reports at
CircleCI received exit code 0

Steps to Reproduce

  1. Run CircleCI build with Codecov orb upload step that uploads .resultset.json

  2. bash <(curl -s -f coverage/.resultset.json -t XXXXXXXXX

Expected behavior: Reports visible on codecov

Actual behavior: There was an error processing coverage reports.

Flakiness? Always, since update

Additional Information

Please let me know what else I can include to help troubleshoot. Thank you!

Hi @sarahstrong, would you mind sharing the Codecov output from using the Ruby gem?

Here’s the output of codecov invoked locally:

/ | | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / `|/ _ / / _ \ \ / /
| |
| (
) | (
| | __/ (
| (
) \ V /
______/ _,|_|____/ _/
x> No CI provider detected.
==> Appending file network
==> Gzipping contents
==> Uploading reports
query: token=secret&flags&package=ruby-0.2.8&branch=fix%2Fcodecov-experiment&commit=b91ef056db7b5a81078cee9db648b9bc583ba583
-> Pinging Codecov
-> Uploading to
Error uploading coverage reports to Codecov. Sorry
no implicit conversion of nil into String
-> Could not upload reports via v4 API, defaulting to v2
-> Uploading to Codecov
Error uploading coverage reports to Codecov. Sorry
no implicit conversion of nil into String

Codecov invoked via

require ‘simplecov’
SimpleCov.start ‘rails’ do
enable_coverage :branch

require ‘codecov’
SimpleCov.formatter = SimpleCov::Formatter::Codecov

I traced the nil into string issue and it appeared to be inside retry_request when invoked on line 404 of codecov.rb. Here’s the backtrace:

["/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/openssl/buffering.rb:383:in syswrite_nonblock'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/openssl/buffering.rb:383:in write_nonblock’", “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/protocol.rb:277:in block in write0'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/protocol.rb:275:in each’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/protocol.rb:275:in each_with_index'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/protocol.rb:275:in write0’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/protocol.rb:248:in block in write'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/protocol.rb:265:in writing’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/protocol.rb:247:in write'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http/generic_request.rb:189:in send_request_with_body’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http/generic_request.rb:123:in exec'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http.rb:1507:in block in transport_request’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http.rb:1506:in catch'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http.rb:1506:in transport_request’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http.rb:1479:in request'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/airbrake-10.0.5/lib/airbrake/rails/net_http.rb:11:in block in request’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/airbrake-10.0.5/lib/airbrake/rack.rb:23:in capture_timing'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/airbrake-10.0.5/lib/airbrake/rails/net_http.rb:10:in request’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http.rb:1472:in block in request'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http.rb:920:in start’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/2.6.0/net/http.rb:1470:in request'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/airbrake-10.0.5/lib/airbrake/rails/net_http.rb:11:in block in request’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/airbrake-10.0.5/lib/airbrake/rack.rb:23:in capture_timing'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/airbrake-10.0.5/lib/airbrake/rails/net_http.rb:10:in request’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/codecov-0.2.8/lib/codecov.rb:293:in retry_request'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/codecov-0.2.8/lib/codecov.rb:405:in upload_to_v4’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/codecov-0.2.8/lib/codecov.rb:359:in upload_to_codecov'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/codecov-0.2.8/lib/codecov.rb:458:in format’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov/result.rb:51:in format!'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov/configuration.rb:196:in block in at_exit’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov.rb:189:in run_exit_tasks!'", "/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov.rb:179:in at_exit_behavior’”, “/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov/defaults.rb:27:in `block in <top (required)>’”]

I was suspicious about Airbrake (which is an error handler we use) but the issue persists with it disabled.

@sarahstrong, thanks for working with me here. I am not able to reproduce on my end, but would you be able to add a log statement at line 347: puts report['codecov']?

I suspect there might be something wrong there as I can’t figure out what other part of the retry could actually be broken.

The puts just logs the entire report, I’ll copy that at the bottom of my message as [1].

When I retried with a pristine gem aside from the puts my results were slightly different. Looks like a failed upload is not recoverable.

Error uploading coverage reports to Codecov. Sorry
no implicit conversion of nil into String
Traceback (most recent call last):
7: from /home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov/defaults.rb:27:in `block in <top (required)>'
6: from /home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov.rb:179:in `at_exit_behavior'
5: from /home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov.rb:189:in `run_exit_tasks!'
4: from /home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov/configuration.rb:196:in `block in at_exit'
3: from /home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/simplecov-0.19.0/lib/simplecov/result.rb:51:in `format!'
2: from /home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/codecov-0.2.8/lib/codecov.rb:458:in `format'
1: from /home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/codecov-0.2.8/lib/codecov.rb:360:in `upload_to_codecov'
/home/sarah/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/codecov-0.2.8/lib/codecov.rb:406:in `upload_to_v4': undefined method `body' for nil:NilClass (NoMethodError)

[1] Report data:

[snip test files]


[snip hundreds of versions of compiled packs]

[snip actual application files]


[snip thousands of tmp files]

[snip actual application and test files]

<<<<<< network

[snip actual results for all files]

Is there a filesize limit or an upload time limit? From this I’m guessing my crazy amount of tempfiles is the issue. I’ll try setting a codecov.yml with an ignore path and get back to you about whether that worked.

The commit that made the codecov.yml change succeeded but all subsequent commits are failing. I’m a little stumped. Example succeeding build: Example failing build:

@tom , I’m able to get reports to load successfully in the following circumstances:

#1 I have not yet uploaded through Circle, only locally
#2 I make the following changes to codecov.rb, line 499:

invalid_directories = [

puts ['==>'.green, 'Appending file network'].join(' ')
network = []
Dir['**/*'].keep_if do |file|
  if File.file?(file) && !file.end_with?(*invalid_file_types) && !invalid_directories.any? { |dir| file.include?(dir) }

I’m going to file this as an issue on the codecov-ruby gem as well. My current theory is that the file network component is producing far too big a file, and if a single file that is too big has been uploaded to the commit’s endpoint, then that commit’s whole report cannot be processed.

@sarahstrong, I’m working on a small fix here, but this doesn’t get to the root cause. Thanks for the above, I’ll investigate more.

@sarahstrong, I have incorporated your changes into the PR, thanks!

Awesome, thanks. Maybe if the gem allowed disable file network (I’m not sure what that’s for so maybe it’s necessary?) or configure ignore paths for file network it could fix this issue?

Edit: Oh missed your followup, looks good, thanks!

@sarahstrong, unfortunately file network is critical for the v4 endpoint to work. I’ll hopefully get this in today.

@sarahstrong, I just released 0.2.10, would you be able to see if that works for you?

Wow so fast, thank you! I’ll get back to you after some testing.

@tom thank you for all your help. It’s currently working unmodified locally, but not through CircleCI. Example local output:


x> No CI provider detected.
==> Appending file network
==> Gzipping contents
==> Uploading reports
query: token=secret&flags&package=ruby-0.2.10&branch=fix%2Fcodecov-again&commit=a30c1e2acef5693bf30ace34f51b042738d74779
-> Pinging Codecov
-> Uploading to
View reports at

Example Circle output:


==> Circle CI detected
==> Appending file network
==> Gzipping contents
==> Uploading reports
query: token=secret&flags&package=ruby-0.2.10&service=circleci&build=3050&job=0&slug=majority-labs%2Ffuture-majority&pr&branch=fix%2Fcodecov-again&commit=6c8fd02154398bca74b9b3188073d0abbc970412
-> Pinging Codecov
-> Uploading to
View reports at
CircleCI received exit code 0

I’ve also tried uploading reports through the Codecov Circle orb, same results: “There was an error processing coverage reports.”

Hi @sarahstrong, thanks for this. I released 0.2.11 which I think will help mitigate the issue. Would you mind checking?

@tom thank you so much, it worked! Let me just get the version bump into master and confirm it works against commits including tracked file changes.

1 Like

@sarahstrong woo hoo!! Glad it worked and thank you so much for all the help :pray:!

1 Like

Confirmed working with new PRs! Thanks so so much @tom, you really went above and beyond.

1 Like