tmuxp: `tmuxp load` AssertionError or loads session only partially

Step 1: Provide a summary of your problem

Previously working setup now only opens the first window when loading a new session using tmuxp load

Step 2: Provide tmuxp details

`tmuxp debug-info`

-------------------------
environment:
	dist: macOS-13.1-arm64-arm-64bit
	arch: arm64
	uname: Darwin; REDACTED.local; 22.2.0
	version: Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000
-------------------------
python version: 3.11.1 (main, Dec 23 2022, 09:28:24) [Clang 14.0.0 (clang-1400.0.29.202)]
system PATH: REDACTED
tmux version: 3.3
libtmux version: 0.18.2
tmuxp version: 1.24.0
tmux path: /opt/homebrew/bin/tmux
tmuxp path: /opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/tmuxp
shell: /opt/homebrew/bin/zsh
-------------------------
tmux sessions:
	dotfiles: 1 windows (created Tue Jan  3 12:56:29 2023) (attached)
	tracking: 1 windows (created Wed Jan  4 11:54:03 2023)

tmux windows:
	1: dotfiles* (2 panes) [426x85] [layout fc8c,426x85,0,0{212x85,0,0,1,213x85,213,0,2}] @1 (active)

tmux panes:
	1: [212x85] [history 21/50000, 447700 bytes] %1
	2: [213x85] [history 1464/50000, 718639 bytes] %2 (active)

tmux global options:
	@net_speed_interfaces en0
	@plugin jimeh/tmux-themepack
	@powerline-color-activity-1 colour75
	@powerline-color-black-1 black
	@powerline-color-grey-1 colour233
	@powerline-color-grey-2 colour235
	@powerline-color-grey-3 colour238
	@powerline-color-grey-4 colour240
	@powerline-color-grey-5 colour243
	@powerline-color-grey-6 colour245
	@powerline-color-main-1 colour39
	@powerline-color-main-2 colour81
	@powerline-color-main-3 colour75
	@powerline-status-bg colour233
	@powerline-status-fg colour240
	@powerline-status-left-area-left-bg colour39
	@powerline-status-left-area-left-fg colour233
	@powerline-status-left-area-middle-bg colour240
	@powerline-status-left-area-middle-fg colour233
	@powerline-status-left-area-right-bg colour235
	@powerline-status-left-area-right-fg colour240
	@powerline-status-left-bg colour233
	@powerline-status-left-fg colour243
	@powerline-status-right-area-left-bg colour235
	@powerline-status-right-area-left-fg colour240
	@powerline-status-right-area-middle-bg colour240
	@powerline-status-right-area-middle-fg colour233
	@powerline-status-right-area-right-bg colour245
	@powerline-status-right-area-right-fg colour233
	@powerline-status-right-bg colour233
	@powerline-status-right-fg colour243
	@resurrect-restore-script-path /Users/mirosval/.tmux/plugins/tmux-resurrect/scripts/restore.sh
	@resurrect-save-script-path /Users/mirosval/.tmux/plugins/tmux-resurrect/scripts/save.sh
	@resurrect-strategy-irb default_strategy
	@resurrect-strategy-mosh-client default_strategy
	@resurrect-strategy-nvim session
	@resurrect-strategy-vim session
	@theme-clock-mode-colour colour39
	@theme-clock-mode-style 24
	@theme-display-panes-active-colour colour245
	@theme-display-panes-colour colour233
	@theme-message-bg colour39
	@theme-message-command-bg colour39
	@theme-message-command-fg black
	@theme-message-fg black
	@theme-mode-bg colour39
	@theme-mode-fg black
	@theme-pane-active-border-bg default
	@theme-pane-active-border-fg colour39
	@theme-pane-border-bg default
	@theme-pane-border-fg colour238
	@theme-status-bg colour233
	@theme-status-fg colour240
	@theme-status-interval 1
	@theme-status-justify centre
	@theme-status-left "#[fg=colour233,bg=colour39,bold] #S #[fg=colour39,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]"
	@theme-status-left-bg colour233
	@theme-status-left-fg colour243
	@theme-status-left-length 40
	@theme-status-left-prefix ''
	@theme-status-left-suffix ''
	@theme-status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour233,bg=colour245,bold] #H "
	@theme-status-right-bg colour233
	@theme-status-right-fg colour243
	@theme-status-right-length 150
	@theme-status-right-prefix ''
	@theme-status-right-suffix ''
	@theme-window-status-activity-bg colour233
	@theme-window-status-activity-fg colour75
	@theme-window-status-current-bg colour39
	@theme-window-status-current-fg black
	@theme-window-status-current-format " #I:#W#F "
	@theme-window-status-current-prefix ''
	@theme-window-status-current-suffix ''
	@theme-window-status-format " #I:#W#F "
	@theme-window-status-prefix ''
	@theme-window-status-separator ''
	@theme-window-status-suffix ''
	@themepack powerline/block/cyan
	@themepack-status-left-area-left-format "#S"
	@themepack-status-left-area-left-prefix ''
	@themepack-status-left-area-left-suffix ''
	@themepack-status-left-area-middle-format "#(whoami)"
	@themepack-status-left-area-middle-prefix ''
	@themepack-status-left-area-middle-suffix ''
	@themepack-status-left-area-right-format "#I:#P"
	@themepack-status-left-area-right-prefix ''
	@themepack-status-left-area-right-suffix ''
	@themepack-status-right-area-left-format "%H:%M:%S"
	@themepack-status-right-area-left-prefix ''
	@themepack-status-right-area-left-suffix ''
	@themepack-status-right-area-middle-format "%d-%b-%y"
	@themepack-status-right-area-middle-prefix ''
	@themepack-status-right-area-middle-suffix ''
	@themepack-status-right-area-right-format "#H"
	@themepack-status-right-area-right-prefix ''
	@themepack-status-right-area-right-suffix ''
	@themepack-window-status-current-format "#I:#W#F"
	@themepack-window-status-current-prefix ''
	@themepack-window-status-current-suffix ''
	@themepack-window-status-format "#I:#W#F"
	@themepack-window-status-prefix ''
	@themepack-window-status-suffix ''
	activity-action other
	assume-paste-time 1
	base-index 1
	bell-action any
	default-command "reattach-to-user-namespace -l /opt/homebrew/bin/zsh"
	default-shell /opt/homebrew/bin/zsh
	default-size 80x24
	destroy-unattached off
	detach-on-destroy on
	display-panes-active-colour colour245
	display-panes-colour colour233
	display-panes-time 1000
	display-time 4000
	history-limit 50000
	key-table root
	lock-after-time 0
	lock-command "lock -np"
	message-command-style fg=black,bg=colour39
	message-style fg=black,bg=colour39
	mouse on
	prefix C-b
	prefix2 None
	renumber-windows on
	repeat-time 500
	set-titles off
	set-titles-string "#S:#I:#W - \"#T\" #{session_alerts}"
	silence-action other
	status on
	status-bg default
	status-fg default
	status-format[0] "#[align=left range=left #{E:status-left-style}]#[push-default]#{T;=/#{status-left-length}:status-left}#[pop-default]#[norange default]#[list=on align=#{status-justify}]#[list=left-marker]<#[list=right-marker]>#[list=on]#{W:#[range=window|#{window_index} #{E:window-status-style}#{?#{&&:#{window_last_flag},#{!=:#{E:window-status-last-style},default}}, #{E:window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{E:window-status-bell-style},default}}, #{E:window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{E:window-status-activity-style},default}}, #{E:window-status-activity-style},}}]#[push-default]#{T:window-status-format}#[pop-default]#[norange default]#{?window_end_flag,,#{window-status-separator}},#[range=window|#{window_index} list=focus #{?#{!=:#{E:window-status-current-style},default},#{E:window-status-current-style},#{E:window-status-style}}#{?#{&&:#{window_last_flag},#{!=:#{E:window-status-last-style},default}}, #{E:window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{E:window-status-bell-style},default}}, #{E:window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{E:window-status-activity-style},default}}, #{E:window-status-activity-style},}}]#[push-default]#{T:window-status-current-format}#[pop-default]#[norange list=on default]#{?window_end_flag,,#{window-status-separator}}}#[nolist align=right range=right #{E:status-right-style}]#[push-default]#{T;=/#{status-right-length}:status-right}#[pop-default]#[norange default]"
	status-format[1] "#[align=centre]#{P:#{?pane_active,#[reverse],}#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
	status-interval 1
	status-justify centre
	status-keys emacs
	status-left "#[fg=colour232,bg=colour255,bold] #S #[fg=colour255,bg=colour250,nobold]#[fg=0,bg=colour250] #(whoami) #[fg=colour250,bg=colour245]#[fg=0,bg=colour245] #I:#P #[fg=colour245,bg=colour240]#[fg=0,bg=colour240] %b %d %H:%M:%S #[fg=colour240,bg=colour233,nobold]"
	status-left-length 100
	status-left-style fg=colour243,bg=colour233
	status-position bottom
	status-right "#[fg=colour245,bg=colour233]#[fg=0,bg=colour245] #(diffmetrik --metric download) #(diffmetrik --metric upload) #[fg=colour250,bg=colour245]#[fg=0,bg=colour250] bat: #(~/.dotfiles/scripts/battery.sh)%%  #[fg=colour255,bg=colour250,bold]#[fg=colour0,bg=colour255]#(~/.dotfiles/scripts/spotify.sh)"
	status-right-length 150
	status-right-style fg=colour243,bg=colour233
	status-style fg=colour240,bg=colour233
	update-environment[0] DISPLAY
	update-environment[1] KRB5CCNAME
	update-environment[2] SSH_ASKPASS
	update-environment[3] SSH_AUTH_SOCK
	update-environment[4] SSH_AGENT_PID
	update-environment[5] SSH_CONNECTION
	update-environment[6] WINDOWID
	update-environment[7] XAUTHORITY
	visual-activity off
	visual-bell off
	visual-silence off
	word-separators "!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~"

tmux window options:
	cursor-colour none
	cursor-style default
	aggressive-resize on
	allow-passthrough off
	allow-rename off
	alternate-screen on
	automatic-rename on
	automatic-rename-format "#{?pane_in_mode,[tmux],#{pane_current_command}}#{?pane_dead,[dead],}"
	clock-mode-colour colour39
	clock-mode-style 24
	copy-mode-match-style bg=cyan,fg=black
	copy-mode-current-match-style bg=magenta,fg=black
	copy-mode-mark-style bg=red,fg=black
	fill-character ''
	main-pane-height 24
	main-pane-width 80
	mode-keys vi
	mode-style fg=black,bg=colour39
	monitor-activity off
	monitor-bell on
	monitor-silence 0
	other-pane-height 0
	other-pane-width 0
	pane-active-border-style fg=colour39,bg=default
	pane-base-index 1
	pane-border-format "#{?pane_active,#[reverse],}#{pane_index}#[default] \"#{pane_title}\""
	pane-border-indicators colour
	pane-border-lines single
	pane-border-status off
	pane-border-style fg=colour238,bg=default
	pane-colours
	popup-style default
	popup-border-style default
	popup-border-lines single
	remain-on-exit off
	remain-on-exit-format "Pane is dead (#{?#{!=:#{pane_dead_status},},status #{pane_dead_status},}#{?#{!=:#{pane_dead_signal},},signal #{pane_dead_signal},}, #{t:pane_dead_time})"
	scroll-on-clear on
	synchronize-panes off
	window-active-style default
	window-size latest
	window-style default
	window-status-activity-style fg=colour75,bg=colour233
	window-status-bell-style reverse
	window-status-current-format " #I:#W#F "
	window-status-current-style fg=black,bg=colour39
	window-status-format " #I:#W#F "
	window-status-last-style default
	window-status-separator ''
	window-status-style default
	wrap-search on
	xterm-keys on

Step 3: Describe the problem:

Steps to reproduce:

Have a file like this:

session_name: some name
windows:
  - window_name: a
    layout: main-vertical
    options:
      main-pane-width: 50%
    shell_command_before: cd ~/work/a
    panes:
      - nvim
      - neofetch
  - window_name: b
    layout: main-vertical
    options:
      main-pane-width: 50%
    shell_command_before: cd ~/work/b
    panes:
      - nvim
      - neofetch

Do

tmuxp load ~/.config/tmuxp/some_name.yml

Observed Results:

Traceback (most recent call last):
  File "/opt/homebrew/bin/tmuxp", line 8, in <module>
    sys.exit(cli.cli())
             ^^^^^^^^^
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/tmuxp/cli/__init__.py", line 134, in cli
    command_load(
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/tmuxp/cli/load.py", line 642, in command_load
    load_workspace(
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/tmuxp/cli/load.py", line 436, in load_workspace
    _load_attached(builder, detached)
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/tmuxp/cli/load.py", line 184, in _load_attached
    builder.build()
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/tmuxp/workspace/builder.py", line 292, in build
    for window, window_config in self.iter_create_windows(session, append):
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/tmuxp/workspace/builder.py", line 420, in iter_create_windows
    window.set_window_option(key, val)
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/libtmux/window.py", line 346, in set_window_option
    self.refresh()
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/libtmux/window.py", line 84, in refresh
    return super()._refresh(
           ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/libtmux/neo.py", line 174, in _refresh
    obj = fetch_obj(
          ^^^^^^^^^^
  File "/opt/homebrew/Cellar/tmuxp/1.24.0/libexec/lib/python3.11/site-packages/libtmux/neo.py", line 242, in fetch_obj
    assert obj is not None
           ^^^^^^^^^^^^^^^
AssertionError

Sometimes when I run the command immediately again, it works, but only creates the first window of the two

Expected Results:

Create and open the new session with both windows and all panels

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@xbatist This is excellent! Thank you for the information and testing!

@mirosval @cmollet I am going to close this now per v1.25.0 w/ libtmux v0.19.1. If you find it’s still not working, let me know and I will re-open.

All good on my side ! It’s back to normal. Thanks a lot for your quick fix.

Thank you!

However, the traceback posted by @mirosval looks very similar to what I remember, assert obj is not None was definitely the Exception.

if by chance it happens against and you have the full traceback, it’d be helpful to see!

For anyone else posting, if you can provide your full config + tmuxp debug-info + the traceback that would be valuable!

@tony I can confirm that commenting out options results in both windows and all commands setting up properly. Of course with the incorrect scaling now, as the main-pane-width is not applied.