Crash in Lua coroutine when accessing player

Describe the issue as detailed as you can. Below is a list of questions that should be answered in the description (if they apply).

  • Is the problem OpenMW specific or does it also happen in vanilla Morrowind? OpenMW-specific
  • What is your operating system? Linux 6.12.40 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jul 24 06:56:38 UTC 2025 x86_64 GNU/Linux
  • What version of OpenMW are you using? If you used a bleeding edge build, state the exact revision used. I've reproduced the crash on both !4954 and 0.50-rc2
  • What version of Morrowind are you using (i.e. retail CD or Steam)? What addons (Tribunal, Bloodmoon) do you have installed? What language is your Morrowind install? MTB Ru 1C version
  • Do you use any mods? If so, does the problem also occur in a clean vanilla install without any mods? It happens on clean install
  • What are the exact steps to reproduce the problem? Run the game, open console then do
luag
world = require("openmw.world")
co = coroutine.wrap(function() print(world.players[1].type) end)
co()
--CRASH--
  • What did you expect to happen? What happened instead?
  • Are there any error messages in your openmw.log file? If you're not an OpenMW team member, it's best to upload it.
Click to expand [01:48:48.828 *] Crash handler installed [01:48:48.910 *] Loading config file: /nix/store/ffzy73dkdlwclb6xy8n7dm07fr75rci9-openmw-openmw-0.49.0-unstable-2025-09-06/etc/openmw/openmw.cfg [01:48:48.911 *] Loading config file: /home/user/.config/openmw/openmw.cfg [01:48:48.912 *] Logs dir: /home/user/.config/openmw/ [01:48:48.912 *] User data dir: /home/user/.local/share/openmw/ [01:48:48.912 *] Screenshots dir: /home/user/.local/share/openmw/screenshots [01:48:48.913 I] OpenMW version 0.50.0 [01:48:48.913 I] Loading settings file: /nix/store/ffzy73dkdlwclb6xy8n7dm07fr75rci9-openmw-openmw-0.49.0-unstable-2025-09-06/etc/openmw/defaults.bin [01:48:48.914 I] Loading settings file: /home/user/.config/openmw/settings.cfg [01:48:48.915 I] Using Cyrillic font encoding. [01:48:48.915 I] OSG version: 3.6.5 [01:48:48.915 I] SDL version: 2.32.56 [01:48:48.915 I] Loading shader settings file: /home/user/.config/openmw/shaders.yaml [01:48:49.054 I] OpenGL Vendor: AMD [01:48:49.055 I] OpenGL Renderer: AMD Radeon Graphics (radeonsi, renoir, ACO, DRM 3.61, 6.12.40) [01:48:49.055 I] OpenGL Version: 4.6 (Compatibility Profile) Mesa 25.2.2 [01:48:49.055 I] Using reverse-z depth buffer [01:48:49.055 I] Adding BSA archive /crucial/games/wine/Morrowind/Data Files/Tribunal.bsa [01:48:49.056 I] Adding BSA archive /crucial/games/wine/Morrowind/Data Files/Morrowind.bsa [01:48:49.061 I] Adding BSA archive /crucial/games/wine/Morrowind/Data Files/Bloodmoon.bsa [01:48:49.062 I] Adding data directory /nix/store/ffzy73dkdlwclb6xy8n7dm07fr75rci9-openmw-openmw-0.49.0-unstable-2025-09-06/share/games/openmw/resources/vfs [01:48:49.063 I] Adding data directory /nix/store/ffzy73dkdlwclb6xy8n7dm07fr75rci9-openmw-openmw-0.49.0-unstable-2025-09-06/share/games/openmw/resources/vfs-mw [01:48:49.063 I] Adding data directory /crucial/games/wine/Morrowind/Data Files [01:48:49.086 I] Adding data directory /home/user/.local/share/openmw/data [01:48:49.095 I] Preferred locales: gmst en [01:48:49.096 I] Initializing LuaUtil::LuaState with profiler [01:48:49.096 I] Lua version: Lua 5.1.4 (LuaJIT 2.1.1741730670) [01:48:49.096 I] Loading keybindings file: /home/user/.config/openmw/input_v3.xml [01:48:49.097 I] Loading font file magic_cards_regular.fnt [01:48:49.101 I] Loading font file daedric_font.fnt [01:48:49.104 I] Loading font file DejaVuLGCSansMono.omwfont [01:48:49.133 I] Initializing OpenAL... [01:48:49.147 I] Opened "Family 17h/19h/1ah HD Audio Controller Analog Stereo" [01:48:49.148 I] ALC Version: 1.1 [01:48:49.148 I] ALC Extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_debug ALC_EXT_DEDICATED ALC_EXT_direct_context ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFT_loopback_bformat ALC_SOFT_output_limiter ALC_SOFT_output_mode ALC_SOFT_pause_device ALC_SOFT_reopen_device ALC_SOFT_system_events [01:48:49.208 I] Vendor: OpenAL Community [01:48:49.208 I] Renderer: OpenAL Soft [01:48:49.208 I] Version: 1.1 ALSOFT 1.24.3 [01:48:49.208 I] Extensions: AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_debug AL_EXT_direct_context AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STATIC_BUFFER AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_bformat_ex AL_SOFT_bformat_hoa AL_SOFT_block_alignment AL_SOFT_buffer_length_query AL_SOFT_callback_buffer AL_SOFTX_convolution_effect AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFT_direct_channels_remix AL_SOFT_effect_target AL_SOFT_events AL_SOFT_gain_clamp_ex AL_SOFTX_hold_on_disconnect AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFTX_source_panning AL_SOFT_source_resampler AL_SOFT_source_spatialize AL_SOFT_source_start_delay AL_SOFT_UHJ AL_SOFT_UHJ_ex [01:48:49.208 I] Enabled HRTF Built-In HRTF [01:48:49.208 V] Using idle priority for thread=140735709959872 [01:48:49.209 I] Allocated 256 sound sources [01:48:49.209 I] Low-pass filter supported [01:48:49.209 I] EAX Reverb supported [01:48:49.209 I] Enumerated output devices: [01:48:49.209 I] Family 17h/19h/1ah HD Audio Controller Analog Stereo Renoir Radeon High Definition Audio Controller Pro 8 Renoir Radeon High Definition Audio Controller Pro Renoir Radeon High Definition Audio Controller Pro 7 [01:48:49.210 I] Enumerated HRTF names: [01:48:49.210 I] Default HRTF Built-In HRTF [01:48:49.210 E] Failed to open video: Resource 'video/bethesda logo.bik' not found [01:48:49.211 I] Loading content file builtin.omwscripts [01:48:49.211 I] Loading content file Morrowind.esm [01:48:49.543 I] Loading content file Tribunal.esm [01:48:49.596 I] Loading content file Bloodmoon.esm [01:48:49.700 V] Enchantment "test magic axe": dropping unexpected skill argument of sEffectFortifyMagickaMultiplier effect [01:48:49.961 I] Using 2 async physics threads [01:48:49.962 I] Using /home/user/.local/share/openmw/navmesh.db to store navigation mesh cache [01:48:49.967 V] Disabling Multiview (disabled by config) [01:48:49.967 I] Using rendering with shaders by default, requested by: [01:48:49.967 I] - radial fog [01:48:49.967 I] - soft particles [01:48:49.967 I] - shadows [01:48:49.967 I] - lighting method [01:48:49.967 I] - reverse-Z depth buffer [01:48:49.968 V] Using idle priority for thread=140735273760448 [01:48:49.968 I] Reserving texture units for shadow maps: 29..31 [01:48:49.971 I] Reserving texture unit for opaque depth texture: 28 [01:48:49.998 I] Initialized compute shader pipeline for water ripples [01:48:50.006 V] Language file "l10n/Interface/gmst.yaml" is enabled [01:48:50.006 V] Language file "l10n/Interface/en.yaml" is enabled [01:48:50.047 V] Language file "l10n/OMWEngine/gmst.yaml" is enabled [01:48:50.049 V] Language file "l10n/OMWEngine/en.yaml" is enabled [01:48:50.098 V] Language file "l10n/OMWShaders/en.yaml" is enabled [01:48:50.114 I] Loading Lua storage "/home/user/.config/openmw/global_storage.bin" (140 bytes) [01:48:50.114 I] Loading Lua storage "/home/user/.config/openmw/player_storage.bin" (817 bytes) [01:48:50.128 V] Lua scripts configuration (33 scripts): [01:48:50.128 V] #0 MENU PLAYER : scripts/omw/mwui/init.lua [01:48:50.128 V] #1 (closed) MENU : scripts/omw/settings/menu.lua [01:48:50.128 V] #2 (closed) PLAYER : scripts/omw/settings/player.lua [01:48:50.128 V] #3 (closed) GLOBAL : scripts/omw/settings/global.lua [01:48:50.128 V] #4 (closed) GLOBAL : scripts/omw/activationhandlers.lua [01:48:50.128 V] #5 (closed) GLOBAL : scripts/omw/cellhandlers.lua [01:48:50.128 V] #6 (closed) GLOBAL : scripts/omw/usehandlers.lua [01:48:50.128 V] #7 (closed) GLOBAL : scripts/omw/worldeventhandlers.lua [01:48:50.128 V] #8 (closed) GLOBAL : scripts/omw/crimes.lua [01:48:50.128 V] #9 (closed) PLAYER CREATURE NPC : scripts/omw/mechanics/animationcontroller.lua [01:48:50.128 V] #10 (closed) PLAYER : scripts/omw/skillhandlers.lua [01:48:50.128 V] #11 (closed) PLAYER : scripts/omw/mechanics/playercontroller.lua [01:48:50.128 V] #12 (closed) MENU : scripts/omw/camera/settings.lua [01:48:50.128 V] #13 (closed) MENU : scripts/omw/input/settings.lua [01:48:50.128 V] #14 (closed) PLAYER : scripts/omw/input/playercontrols.lua [01:48:50.128 V] #15 (closed) PLAYER : scripts/omw/camera/camera.lua [01:48:50.128 V] #16 (closed) PLAYER : scripts/omw/input/actionbindings.lua [01:48:50.128 V] #17 (closed) PLAYER : scripts/omw/input/smoothmovement.lua [01:48:50.128 V] #18 (closed) PLAYER : scripts/omw/input/gamepadcontrols.lua [01:48:50.128 V] #19 (closed) NPC CREATURE : scripts/omw/ai.lua [01:48:50.128 V] #20 GLOBAL : scripts/omw/mechanics/globalcontroller.lua [01:48:50.128 V] #21 (closed) PLAYER CREATURE NPC : scripts/omw/mechanics/actorcontroller.lua [01:48:50.128 V] #22 (closed) GLOBAL : scripts/omw/combat/global.lua [01:48:50.128 V] #23 (closed) MENU : scripts/omw/combat/menu.lua [01:48:50.128 V] #24 (closed) PLAYER NPC CREATURE : scripts/omw/combat/local.lua [01:48:50.128 V] #25 (closed) PLAYER : scripts/omw/ui.lua [01:48:50.128 V] #26 (closed) MENU : scripts/omw/console/menu.lua [01:48:50.128 V] #27 (closed) PLAYER : scripts/omw/console/player.lua [01:48:50.128 V] #28 (closed) GLOBAL : scripts/omw/console/global.lua [01:48:50.128 V] #29 (closed) CUSTOM : scripts/omw/console/local.lua [01:48:50.128 V] #30 (closed) PLAYER : scripts/omw/music/music.lua [01:48:50.128 V] #31 (closed) MENU : scripts/omw/music/settings.lua [01:48:50.128 V] #32 (closed) NPC CREATURE : scripts/omw/music/actor.lua [01:48:50.131 V] Language file "l10n/OMWCamera/en.yaml" is enabled [01:48:50.133 V] Language file "l10n/OMWControls/en.yaml" is enabled [01:48:50.134 V] Language file "l10n/interface/gmst.yaml" is enabled [01:48:50.134 V] Language file "l10n/interface/en.yaml" is enabled [01:48:50.135 V] Language file "l10n/OMWCombat/en.yaml" is enabled [01:48:50.135 V] Language file "l10n/Calendar/gmst.yaml" is enabled [01:48:50.136 V] Language file "l10n/Calendar/en.yaml" is enabled [01:48:50.136 V] Language file "l10n/OMWMusic/en.yaml" is enabled [01:48:50.139 I] Playing "music/special/morrowind title.mp3" [01:48:50.140 E] Failed to open video: Resource 'video/mw_logo.bik' not found [01:48:54.165 I] Reading save file Quicksave.omwsave [01:48:54.180 I] Loading saved game 'Quicksave' for character 'Test' [01:48:54.252 I] Warning: lookoutScript[local variables] line 41, column 37 (=): invalid operator =, treating it as == [01:48:55.339 I] Loading cell Balmora (-3, -2) [01:48:55.430 I] Loading cell West Gash Region (-3, -1) [01:48:55.434 I] Loading cell Balmora (-2, -2) [01:48:55.449 I] Loading cell Balmora (-4, -2) [01:48:55.459 I] Loading cell Balmora (-3, -3) [01:48:55.464 V] Controller R2_Claw02 present more than once in meshes/r/xsiltstrider.kf, ignoring later version [01:48:55.508 I] Loading cell West Gash Region (-2, -1) [01:48:55.517 I] Loading cell Bitter Coast Region (-4, -1) [01:48:55.520 I] Loading cell West Gash Region (-2, -3) [01:48:55.527 I] Loading cell West Gash Region (-4, -3) [01:48:55.576 I] Warning: OutsideBanner line 38, column 6 (endif): endif without matching if/elseif [01:48:56.716 I] Playing "music/explore/mx_explore_2.mp3"

*** Fatal Error *** (signal 11) Address: (nil)

Generating /tmp/nix-shell-2985169-0/openmw-crash.log and killing process 2986425, please wait... Killed

  • What settings do you use? If you're not an OpenMW team member, it's best to upload your settings.cfg.
Click to expand

This is the OpenMW user 'settings.cfg' file. This file only contains

explicitly changed settings. If you would like to revert a setting

to its default, simply remove it from this file. For available

settings, see the file 'files/settings-default.cfg' in our source repo or the documentation at:

https://openmw.readthedocs.io/en/master/reference/modding/settings/index.html

[Lua] debug = true

[Camera] viewing distance = 32768

[Fog] sky blending start = 0.8 radial fog = true

[Shaders] auto use object normal maps = true auto use object specular maps = true auto use terrain normal maps = true auto use terrain specular maps = true lighting method = shaders soft particles = true weather particle occlusion = true max lights = 32

[GUI] color topic enable = true font size = 18 stretch menu background = true scaling factor = 1.5

[Game] NPCs avoid collisions = true always allow stealing from knocked out actors = true barter disposition change is permanent = true followers attack on sight = true normalise race speed = true only appropriate ammunition bypasses resistance = true prevent merchant equipping = true show effect duration = true show enchant chance = true show melee info = true show owned = 2 show projectile damage = true swim upward correction = true unarmed creature attacks damage armor = true shield sheathing = true smooth movement = true strength influences hand to hand = 1 turn to movement direction = true use additional anim sources = true use magic item animations = true weapon sheathing = true

[Map] allow zooming = true

[Shadows] actor shadows = true enable shadows = true object shadows = true player shadows = true

[Sound] hrtf = Built-In HRTF hrtf enable = 1 music volume = 0 sfx volume = 0.508351 master volume = 0.247225

[Terrain] distant terrain = true

[Video] framerate limit = 120 resolution x = 1920 resolution y = 1056 window mode = 2 window border = true

[Saves] character = Test

[Physics] async num threads = 2

[Post Processing] enabled = true

[General] texture mipmap = linear preferred locales = en,en

[Water] reflection detail = 3 refraction = true rtt size = 2048 shader = true

[HUD] crosshair = true useLuaUI = true

[Windows] console h = 0.464489 console w = 0.610156 console x = 0.0234375 console y = 0.0227273 debug w = 0.388281 debug x = 0.611719

I reproduced the crash on my MR branch in Clion and it produced following stack in Debug mode when the crash happened:

<unknown> 0x00007ffff38fe52e
sol::basic_protected_function::luacall<…> reference.hpp:742
sol::basic_protected_function::invoke<…>(sol::types<…>, std::integer_sequence<…>, long, sol::detail::protected_handler<…> &) const protected_function.hpp:346
sol::basic_protected_function<sol::basic_reference<false>, false, sol::basic_reference<false> >::call<, sol::basic_object<sol::basic_reference<false> >&>(sol::basic_object<sol::basic_reference<false> >&) const protected_function.hpp:229
sol::basic_protected_function::operator()<…> protected_function.hpp:213
LuaUtil::call<…> luastate.hpp:260
operator() scriptscontainer.cpp:378
operator() luastate.hpp:97
_FUN luastate.hpp:97
sol::detail::trampoline<…> trampoline.hpp:158
sol::detail::c_trampoline trampoline.hpp:183
LuaUtil::LuaState::invokeProtectedCall<…> state_view.hpp:117
LuaUtil::LuaState::protectedCall<…> luastate.hpp:110
LuaUtil::ScriptsContainer::receiveEvent scriptscontainer.cpp:361
MWLua::LuaEvents::callEventHandlers luaevents.cpp:41
MWLua::LuaManager::update luamanagerimp.cpp:223
MWLua::Worker::update worker.cpp:71