Why does Rubocop return non-zero exit status when running as post-test command?

This is the output when I run rubocop as a post test command:

rubocop --rails --format progress --format html --out $CIRCLE_ARTIFACTS/rubocop.html returned exit code 1

The artifact is correctly collected, but the build fails (because exit code is non-zero).

If I debug the container and run rubocop, the exit status is zero as expected.

What can be causing rubocop to return exit code 1?