Mods not loaded in headless mode on linux

Hello, when using the headless flag on linux my mod is not recognized anymore when loading it through BeamNGpy or -lua "extensions.load('xlab_xlabCore')".
I get this error: 1.94681|E|GELua.extensions| extension unavailable: "xlab_xlabCore" at location: "xlab/xlabCore"
But without the headless flag it works just well.
My mod is zipped in the user mod folder and provides lua/ge/extensions/xlab/xlabCore.lua.

While looking at the lua codebase I also found this comment:
-headless is working differently than expected and should not be used
Is the -noui flag different?

Any help appreciated.

Hello @comejv,

Headless mode shouldn’t affect the extensions. However, for the time being, please place the /xlab directory inside the following path in your BeamNG.tech root folder

Let me know if you need further assistance!

Hello @asaeed,
Thank you for your answer! Copying lua/ge/extensions/xlab from my mod folder to the BeamNG root sources worked. What’s weird is that:

  • I didn’t need to copy the files in lua/vehicles…
  • I needed to use both -headless and -noui at the same time otherwise the extension cannot be found, even after copying to root folder.

But also the console has a lot of errors due to headless, mainly :

13.24670|E|queueJSUITexture| UI texture '@screen_gps' not found. Unable to execute JS code: map.setData({"terrainTiles":{},"time":"13:20","nodes":{}})
13.35641|E|queueJSUITexture| UI texture '@screen_gps' not found. Unable to execute JS code: map.updateData({"x":-6.5611102399998e-06,"speed":0.027057242766023,"y":-0.00014384717451321,"zoom":150.04058586415,"ignitionLevel":2,"rotation":180.00030133538})
 13.35643|E|queueJSUITexture|     (currently available UI textures: )

I tried putting if headless_mode then return end in a few places in vehicle/controller/beamNavigator.lua without success. Any idea how to suppress the error or fix it?

Thank you.

Hello @comejv,
Thank you for your feedback — we’ll look into it. Could you please let us know your versions of BeamNG.tech, BeamNGpy, and your Linux distribution and version?

Thank you.

Sure thing!
0.35, 1.32, Ubuntu 24.04.2 LTS on kernel 6.8.0-60-generic.

If you need me to run tests on my end don’t hesitate to ask!

1 Like

Hi, thank you for the report, I fixed the issue for 0.36 :slight_smile:

Headless mode is the only mode that works without spawning a window, not sure what the comments in lua codebase try to say.

Thanks a lot! Any quick patch I can apply?

Running with both -headless -noui should work as a quick fix, after the patch -noui can be removed (but should not cause extra issues).

What about the queueJSUITexture errors, any way to block them?

You should be able to patch lua/ge/extensions/ui/uiNavi.lua like this:

local function requestVehicleDashboardMap(dashboard, initmap, vehId)
  if not dashboard then return end
  if headless_mode then return end -- add this line
  local targetVeh = vehId and scenetree.findObjectById(vehId) or  getPlayerVehicle(0)
  if targetVeh then
  -- ... rest of function
end

Or disable/remove any navigation dashboards you are using (the UI app, but also navigation dashboards inside vehicles).

The patch didn’t work. I tried adding that line in uiNavi, beamNavigator, dynoClient and vehicles (basically at every mention of queueJSUITexture) and I still get this error approx 15 times per second:

13.82670|E|queueJSUITexture| UI texture '@screen_gps' not found. Unable to execute JS code: map.updateData({"x":0.0017002310266889,"speed":15.318448448181,"y":-1.7668433804065,"zoom":172.97767267227,"ignitionLevel":2,"rotation":180.11276650324})
 13.82672|E|queueJSUITexture|     (currently available UI textures: )

Is there a way to remove the dashboards using beamngpy? Or in Lua?

Can you please share the script that spams these errors? I cannot reproduce and would have to guess where the issues come from. There are a few more places which call queueJSUITexture under the hood, for example the obj:queueWebViewJS function, but I didn’t manage to set up an environment where I’d get the logspam.

Hello, here is the minimal steps needed to reproduce the issue on my end:

>>> from beamngpy import BeamNGpy, Scenario, Vehicle
>>> b = BeamNGpy(host="127.0.0.1", port=25252)
>>> scenario = Scenario("tech_ground", "On how to use custom mods")
>>> v=Vehicle("ego_vehicle", model="etk800", license="AI")
>>> scenario.add_vehicle(v, pos=(0, 0, 0), rot_quat=(0, 0, 1, 0))
>>> b.open()
<beamngpy.beamng.beamng.BeamNGpy object at 0x7fffe9388b60>
>>> scenario.make(b)
>>> b.scenario.load(scenario)

Exerpts from the lua console that seem relevant:

160.45826|I|spawn| Spawning object 'etk800' with default config
160.48770|D|GELua.core_vehicle_manager.vehicleLoader| partConfigData [string] = ""
160.48877|W|GELua.core_vehicle_partmgmt.| Problems reading requested configuration: ""
160.48885|W|GELua.core_vehicle_partmgmt.main| Supplied config file:  not found. Using default config instead.
160.52286|E|GELua.jbeam.loadJBeamFile| Duplicate part found: license_plate_qld_1 from file /vehicles/common/licenseplates/mount_coottha/license-plate-mountcoottha-2-1.jbeam
...
161.40896|I|BeamNGVehicle| Unable to create UI texture, as UI is disabled
161.41715|I|BeamNGVehicle| Unable to create UI texture, as UI is disabled
161.41726|E|queueJSUITexture| UI texture '@etk800_gauges_screen' not found. Unable to execute JS code: setup({"uiUnitPower":"hp","uiUnitTorque":"metric","uiUnitVolume":"l","uiUnitDate":"ger","uiUnitConsumptionRate":"metric","uiUnitLength":"metric","displayWidth":512,"materialName":"@etk800_gauges_screen","displayHeight":256,"uiUnitWeight":"kg","uiUnitEnergy":"metric","uiUnitPressure":"bar","uiUnitTemperature":"c","htmlPath":"local://local/vehicles/etk800/gauges_screen/gauges_screen.html","unit":"metric"})
161.41726|E|queueJSUITexture|     (currently available UI textures: )
161.42369|E|GELua.scenario_scenarios.scenarios| Prefab: on how to use custom mods already exist in level. Rejecting loading of duplicate.
...
161.93113|D|GELua.core_gamestate.gamestate| exiting : worldReadyState
161.93113|W|GELua.core_gamestate.gamestate| trying to exit state we haven't been in before -please check your code
161.93114|D|GELua.core_gamestate.gamestate| show main menu (false)
161.93115|D|GELua.core_gamestate.gamestate| exiting loading screen to menu
...
162.00093|E|queueJSUITexture| UI texture '@etk800_screen' not found. Unable to execute JS code: map.updateData({"x":9.291918541976e-05,"speed":0.33106674849987,"y":0.00031327302394857,"zoom":150.49660012275,"ignitionLevel":2,"rotation":359.99563368789})
162.00097|E|queueJSUITexture|     (currently available UI textures: )
162.02892|E|queueJSUITexture| UI texture '@etk800_screen' not found. Unable to execute JS code: map.updateData({"x":-4.9842790303956e-05,"speed":0.4200365871191,"y":0.00037013318146251,"zoom":150.63005488068,"ignitionLevel":2,"rotation":359.99943127307})
162.02894|E|queueJSUITexture|     (currently available UI textures: )
162.04114|D|libbeamng.XalVE| Loaded vehicle xlabCore
162.04121|I|libbeamng.TechCom| Started listening on 127.0.0.1/42749.
162.05289|I|GELua.tech_techCore.TechGE| New vehicle connection: 2665, 42749
162.06897|E|queueJSUITexture| UI texture '@etk800_screen' not found. Unable to execute JS code: map.updateData({"x":0.00015931217882326,"speed":0.48061328530312,"y":-0.00023253862434558,"zoom":150.72091992795,"ignitionLevel":2,"rotation":359.99977278252})
162.06899|E|queueJSUITexture|     (currently available UI textures: )
...
162.39889|I|libbeamng.TechVE| Accepted new vehicle client: 127.0.0.1/38918
162.44295|E|queueJSUITexture| UI texture '@etk800_screen' not found. Unable to execute JS code: map.updateData({"x":7.638679729105e-05,"speed":0.32665564119816,"y":-0.00028206199522174,"zoom":150.4899834618,"ignitionLevel":2,"rotation":359.99958153723})
162.44297|E|queueJSUITexture|     (currently available UI textures: )
etc.

And changing the vehicle model to utv gives the @screen_gps errors I reported earlier.

These results are with the suggested requestVehicleDashboardMap patch, without loading my extensions.

Quick update, after trying things from a clean install of BeamNG I realised that putting my mod’s files in the main lua folder is not what resolved the issue, I only needed -noui in addition to -headless.

The queueJSUITexture issue continues.

Hi again, thank you for the update, I tested with the 0.35.5.0 BeamNG.tech build with the -headless argument and the Python script you provided, and I’m not getting any errors relaed to queueJSUITexture. Did you also try without the mod? Only thing I can think of is that one of the files in the mod overrides a BeamNG Lua file, causing this error to happen.

Thank you for the update.
Have you tried with the -noui flag? The issue only appears when I use both -headless and -noui. I need the latter because without it my mod is not found by BNG when using -headless.

On my end the issue appears even on a freshly unzipped BNG and with the mod deleted from user folder.