Describe the bug
I am upgrading Yarn to v2 on a containerized app but when running the yarn install command in an entrypoint script it fails with the following error:
app_1 | (node:92) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise ➤ YN0001: RangeError: Invalid count value
app_1 | at String.repeat (<anonymous>)
app_1 | at f.writeProgress (/.yarn/releases/yarn-berry.js:25:257340)
app_1 | at f.writeLine (/.yarn/releases/yarn-berry.js:25:255483)
app_1 | at f.writeLineWithForgettableReset (/.yarn/releases/yarn-berry.js:25:255562)
app_1 | at f.reportInfo (/.yarn/releases/yarn-berry.js:25:253799)
app_1 | at f.startTimerPromise (/.yarn/releases/yarn-berry.js:25:252776)
app_1 | at async se.install (/.yarn/releases/yarn-berry.js:31:197567)
app_1 | at async /.yarn/releases/yarn-berry.js:71:56013
app_1 | at async Function.start (/.yarn/releases/yarn-berry.js:25:251761)
app_1 | ➤ YN0000: Failed with errors in 2.28s
app_1 | Range Error: Invalid count value
app_1 | at String.repeat (<anonymous>)
app_1 | at f.writeProgress (/.yarn/releases/yarn-berry.js:25:257340)
app_1 | at f.writeLine (/.yarn/releases/yarn-berry.js:25:255483)
app_1 | at f.writeLineWithForgettableReset (/.yarn/releases/yarn-berry.js:25:255562)
app_1 | at f.reportError (/.yarn/releases/yarn-berry.js:25:254427)
app_1 | at finalize (/.yarn/releases/yarn-berry.js:25:255294)
app_1 | at Function.start (/.yarn/releases/yarn-berry.js:25:251822)
This is the relevant part of the docker-compose file:
app:
build:
context: .
target: dev
image: ###
command: puma -C config/puma.rb
entrypoint:
- yarn.sh
Interestingly enough, when I exec into the pod, I am able to run yarn install successfully. It only fails when running docker-compose up
Screenshots

Environment if relevant (please complete the following information):
I have the same problem as soon as I add tty: true in my docker-compose to have colored logs.
Most helpful comment
Fixed in https://github.com/yarnpkg/berry/pull/1485