alainbryden / bitburner-scripts

My own scripts for playing bitburner
MIT License
606 stars 270 forks source link

/Remote/<script>.js cannot be run because it does not have a main function. #16

Closed alainbryden closed 2 years ago

alainbryden commented 2 years ago

I'm keeping this here as a placeholder for any who come here intending to report it.

image

This is a bug with the game (bitburner) itself. There's an open issue in the bitburner backlog: https://github.com/danielyxie/bitburner/issues/1714

It happens because there is a race condition in the game code that will cause calls to ns.scp (or write) to not leave the file in a ready state for a short while after it's first copied / written. As such, when we first copy a script to a new remote server and try to run it, the run might fail that first time, but then work a subsequent time.

alainbryden commented 2 years ago

Still happens sometimes even with the workaround

shinji257 commented 2 years ago

Just poking this closed issue to let you know I still get it from time to time.

alainbryden commented 2 years ago

Indeed, it's been a bit worse since I started RAM dodging school. Maybe just a longer sleep will do

alainbryden commented 2 years ago

New code added to delay after the first exec on each server. Seems to be working.