Skip to content
This repository was archived by the owner on May 24, 2026. It is now read-only.
This repository was archived by the owner on May 24, 2026. It is now read-only.

Error when attempting to save workspace with active top process #144

Description

@midgramr

When I attempt to save my workspace (resurrect.state_manager.save_state(resurrect.workspace_state.get_workspace_state())) that has an active top process running, I get the following error in my debug logs:

19:44:03.148 ERROR wezterm_gui::termwindow > while processing user-defined-13 event: runtime error: ...xersZsresurrectsDswezterm/plugin/resurrect/pane_tree.lua:101: attempt to index a nil value (local 'process_info')
stack traceback:
        ...xersZsresurrectsDswezterm/plugin/resurrect/pane_tree.lua:101: in upvalue 'insert_panes'
        ...xersZsresurrectsDswezterm/plugin/resurrect/pane_tree.lua:133: in function <...xersZsresurrectsDswezterm/plugin/resurrect/pane_tree.lua:73>
        (...tail calls...)
        ...xersZsresurrectsDswezterm/plugin/resurrect/tab_state.lua:74: in function 'resurrect.tab_state.get_tab_state'
        ...sZsresurrectsDswezterm/plugin/resurrect/window_state.lua:17: in function 'resurrect.window_state.get_window_state'
        ...resurrectsDswezterm/plugin/resurrect/workspace_state.lua:57: in function 'resurrect.workspace_state.get_workspace_state'
        /Users/n1v3x/.config/wezterm/plugins/resurrect.lua:35: in function </Users/n1v3x/.config/wezterm/plugins/res.lua:34>

Here's my resurrect config:

local wezterm = require 'wezterm'
local module = {}

local resurrect = wezterm.plugin.require("https://github.com/MLFlexer/resurrect.wezterm")

resurrect.state_manager.periodic_save()

-- loads the state whenever I create a new workspace
wezterm.on('smart_workspace_switcher.workspace_switcher.created', function(window, _, label)
  local workspace_state = resurrect.workspace_state

  workspace_state.restore_workspace(resurrect.state_manager.load_state(label, 'workspace'), {
    window = window,
    relative = true,
    restore_text = true,
    on_pane_restore = resurrect.tab_state.default_on_pane_restore,
  })
end)

-- Saves the state whenever I select a workspace
wezterm.on('smart_workspace_switcher.workspace_switcher.selected', function()
  local workspace_state = resurrect.workspace_state
  resurrect.state_manager.save_state(workspace_state.get_workspace_state())
end)

function module.apply_to_config(config)
  utils.add_keys(config, {
    {
      key = 'w',
      mods = 'META',
      action = wezterm.action_callback(function()
        resurrect.state_manager.save_state(resurrect.workspace_state.get_workspace_state())
      end),
    },
    {
      key = 'r',
      mods = 'META',
      action = wezterm.action_callback(function(win, pane)
        resurrect.fuzzy_loader.fuzzy_load(win, pane, function(id)
          local type = string.match(id, '^([^/]+)')
          id = string.match(id, '([^/]+)$')
          id = string.match(id, '(.+)%..+$')
          local opts = {
            relative = true,
            restore_text = true,
            on_pane_restore = resurrect.tab_state.default_on_pane_restore,
          }
          if type == 'workspace' then
            local state = resurrect.state_manager.load_state(id, 'workspace')
            resurrect.workspace_state.restore_workspace(state, opts)
          elseif type == 'window' then
            local state = resurrect.state_manager.load_state(id, 'window')
            resurrect.window_state.restore_window(pane:window(), state, opts)
          elseif type == 'tab' then
            local state = resurrect.state_manager.load_state(id, 'tab')
            resurrect.tab_state.restore_tab(pane:tab(), state, opts)
          end
        end)
      end),
    },
  })
end

return module

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions