balena-cli: Node buffer too small for large resources during build

I encountered the problem while building an image containing CUDA, TF, OpenCV with the Nvidia Jetson Nano. Since i can not reopen the GitHub issue i mention it here.

 [Debug]   Parsing input...
 [Debug]   Loading project...
 [Debug]   Resolving project...
 [Debug]   docker-compose.yml file found at "/builds/.../..."
 [Debug]   Creating project...
 [Info]    Building for aarch64/jetson-nano
 [Build]   Building services...
 [Build]   jetson-nano-base          Preparing...
 [Info]    Installing qemu for aarch64 emulation...
 [Info]    Emulation is enabled
 [Build]   Built 1 service in 0:01
 [Error]   Build failed
 ERR_FS_FILE_TOO_LARGE: File size (2380747015) is greater than possible Buffer: 2147483647 bytes
 RangeError [ERR_FS_FILE_TOO_LARGE]: File size (2380747015) is greater than possible Buffer: 2147483647 bytes
     at FSReqWrap.readFileAfterStat [as oncomplete] (fs.js:264:11)
 From previous event:
     at readFile (eval at thenify.withCallback (/snapshot/versioned-source/node_modules/thenify/index.js:33:10), <anonymous>:10:8)
     at /snapshot/versioned-source/build/utils/compose.js:156:49
 From previous event:
     at tarDirectory (/snapshot/versioned-source/build/utils/compose.js:153:28)
     at /snapshot/versioned-source/build/utils/compose.js:216:12
 From previous event:
     at Object.exports.buildProject (/snapshot/versioned-source/build/utils/compose.js:215:6)
     at /snapshot/versioned-source/build/actions/build.js:51:20
 From previous event:
     at buildProject (/snapshot/versioned-source/build/actions/build.js:45:60)
     at /snapshot/versioned-source/build/actions/build.js:133:16
 From previous event:
     at /snapshot/versioned-source/build/actions/build.js:132:22
 From previous event:
     at Command.action (/snapshot/versioned-source/build/actions/build.js:129:8)
     at /snapshot/versioned-source/node_modules/capitano/build/command.js:98:37
     at Command.module.exports.Command.applyPermissions (/snapshot/versioned-source/node_modules/capitano/build/command.js:43:14)
     at /snapshot/versioned-source/node_modules/capitano/build/command.js:92:24
     at Command.module.exports.Command._checkElevation (/snapshot/versioned-source/node_modules/capitano/build/command.js:63:14)
     at /snapshot/versioned-source/node_modules/capitano/build/command.js:76:22
     at /snapshot/versioned-source/node_modules/capitano/build/signature.js:177:14
     at _toString (/snapshot/versioned-source/node_modules/capitano/node_modules/async/lib/async.js:52:16)
     at /snapshot/versioned-source/node_modules/capitano/node_modules/async/lib/async.js:269:32
     at /snapshot/versioned-source/node_modules/capitano/node_modules/async/lib/async.js:44:16
     at /snapshot/versioned-source/node_modules/capitano/build/signature.js:171:16
     at _setImmediate (/snapshot/versioned-source/node_modules/capitano/node_modules/async/lib/async.js:181:20)
     at Immediate.iterate (/snapshot/versioned-source/node_modules/capitano/node_modules/async/lib/async.js:262:13)
     at runCallback (timers.js:705:18)
     at tryOnImmediate (timers.js:676:5)
     at processImmediate (timers.js:658:5)
     at process.topLevelDomainCallback (domain.js:126:23)
 If you need help, don't hesitate in contacting our support forums at
 For CLI bug reports or feature requests, have a look at the GitHub issues or
 create a new one at:

It works on balena CLI V. 11.24.0 but does not work with v11.26.0 or v11.28.11 on Linux

Thanks for reporting the bug; it might be worth creating a new issue in the CLI repo and referencing the original - the open tickets will get scanned and picked up quicker :+1:

1 Like

Just for reference:
The issue has been updated and the bug has been caused by pushing large files to the docker deamon, in this case prebuild images since i used the --cache-from option. :slight_smile:

Thank you for letting us know! Have you raised an issue (at If so, please us know the GitHub URL. If you haven’t, no problem. We can raise one for you.

pdcastro reopend the issue for me