Maiden cannot load scripts with exception

Maiden has lost the ability to load any scripts through the file browser. It throws this exception to the Matron console

norns.script.load("code/sines/sines.lua")
lua: /home/we/norns/lua/core/script.lua:127: attempt to call a nil value (field 'split')
stack traceback:
	/home/we/norns/lua/core/script.lua:127: in function 'core/script.load'
	(...tail calls...)

I think this means something in Matron has crashed? I’ve loaded the same scripts from different browsers through a clean session with the same results. The device did lose the wifi connection, followed by a reauth around the time it entered this state. But now it’s stuck in this state despite the device network coming back up.

I think a reboot might be the solution though I don’t know how to reproduce this other than “leave the device on for 22 hours and wait for wifi to deauth/reauth” and I’d like to help out with any kind of debugging. Would this fall under a category of “reconnect bugs”?

The above problem looks unlikely to be related to any WiFi connectivity problems. If I were to guess the most likely causes would be:

  • The script being run is not below the code/ directory (which doesn’t seem to be the case here)
  • Some other script (or sines) has logic which overwrote some global data accidentally (not everything in the menu system is protected)

The first thing I would try is running SYSTEM > RESET in the menu.

Looking at line script.lua:127 in the norns code base it is possible that sines or some other script assigned a value to the tab variable - which is totally reasonable! - but that has/had the side effect of breaking the menu system (which currently assumes tab is the tabutils modules)

some other script assigned a value to the tab variable

This is exactly what I did while inspecting the contents of some tables.

Wow. So…not a connectivity bug but a reserved word bug. I could make an issue in the github project. I feel like this is getting The Principal of Least Surprise wrong.

It’s not so much a reserved word problem but the confluence of (a) all variables in lua are by default global (unless prefixed with local) and (b) the menu system, repl, and scripts are sharing the same lua interpreter (which is necessary for certain things to work)

There are some places; like in this specific instance, where the norns code is depending on globals which are setup when matron starts. The code in question is already changed in the main repo such that this wouldn’t happen (if I read it correctly in my quick inspection).

I can open a more broad ticket about scrubbing the menu system for any usage of globals which isn’t strictly necessary. Ticketed: https://github.com/monome/norns/issues/1288

2 Likes