Skip to content

Runtime error in agenda view #1047

@szaffarano

Description

@szaffarano

Describe the bug

After #1041 I started getting a weird error when opening the Agenda view. It's not related to a particular config but to a file content, and it's weird because when I tried to isolate the error, it only happens when I have many files in org_agenda_files

The error is

Lua :command callback: BufReadPost Autocommands for "*": Vim(append):Lua callback: ...neovim-unwrapped-nightly/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "org": Vim(append):Lua callback: Vim:E518: Unknown option: 5x                                                   
stack traceback:                                                                                                                                                                                                                                                                                                               
        [C]: in function 'bufload'                                                                                                                                                                                                                                                                                             
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/files/file.lua:84: in function 'load'                                                                                                                                                                                                                                       
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/files/init.lua:192: in function 'load_file'                                                                                                                                                                                                                                 
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/files/init.lua:66: in function 'callback'                                                                                                                                                                                                                                   
        .../nvim_orgmode/lazy/orgmode/lua/orgmode/utils/promise.lua:365: in function 'processNext'                                                                                                                                                                                                                             
        .../nvim_orgmode/lazy/orgmode/lua/orgmode/utils/promise.lua:377: in function 'executor'                                                                                                                                                                                                                                
        .../nvim_orgmode/lazy/orgmode/lua/orgmode/utils/promise.lua:107: in function 'map'                                                                                                                                                                                                                                     
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/files/init.lua:65: in function 'load'                                                                                                                                                                                                                                       
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/files/init.lua:257: in function 'load_sync'                                                                                                                                                                                                                                 
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/init.lua:59: in function 'init'                                                                                                                                                                                                                                             
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/init.lua:88: in function 'reload'                                                                                                                                                                                                                                           
        ...                                                                                                                                                                                                                                                                                                                    
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/files/init.lua:66: in function 'callback'                                                                                                                                                                                                                                   
        .../nvim_orgmode/lazy/orgmode/lua/orgmode/utils/promise.lua:365: in function 'processNext'                                                                                                                                                                                                                             
        .../nvim_orgmode/lazy/orgmode/lua/orgmode/utils/promise.lua:377: in function 'executor'                                                                                                                                                                                                                                
        .../nvim_orgmode/lazy/orgmode/lua/orgmode/utils/promise.lua:107: in function 'map'                                                                                                                                                                                                                                     
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/files/init.lua:65: in function 'load'                                                                                                                                                                                                                                       
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/files/init.lua:257: in function 'load_sync'                                                                                                                                                                                                                                 
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/init.lua:59: in function 'init'                                                                                                                                                                                                                                             
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/init.lua:224: in function 'instance'                                                                                                                                                                                                                                        
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/init.lua:33: in function '__index'                                                                                                                                                                                                                                          
        /tmp/nvim_orgmode/lazy/orgmode/lua/orgmode/org/global.lua:24: in function </tmp/nvim_orgmode/lazy/```

checkhealth

==============================================================================
lazy: 2 ⚠️ 1 ❌

lazy.nvim ~

  • {lazy.nvim} version 11.17.2
  • ✅ OK {git} version 2.51.0
  • ✅ OK no existing packages found by other package managers
  • ✅ OK packer_compiled.lua not found

luarocks ~

  • checking hererocks installation
  • ✅ OK no plugins require luarocks, so you can ignore any warnings below
  • ✅ OK {python3} Python 3.14.0
  • ❌ ERROR {/tmp/nvim_orgmode/data/nvim/lazy-rocks/hererocks/bin/luarocks} not installed
  • ⚠️ WARNING {/tmp/nvim_orgmode/data/nvim/lazy-rocks/hererocks/bin/lua} version 5.1 not installed
  • ⚠️ WARNING Lazy won't be able to install plugins that require luarocks.
    Here's what you can do:
    • fix your luarocks installation
    • disable hererocks with opts.rocks.hererocks = false
    • disable luarocks support completely with opts.rocks.enabled = false

==============================================================================
orgmode: 1 ⚠️

Orgmode ~

  • ✅ OK Treesitter grammar installed (version 2.0.0)
  • ✅ OK Setup called
  • ✅ OK org_agenda_files configured
  • ⚠️ WARNING No default notes file configured. Set org_default_notes_file in your config.

==============================================================================
vim.deprecated: ✅

  • ✅ OK No deprecated functions detected

==============================================================================
vim.health: 1 ⚠️ 1 ❌

Configuration ~

  • ⚠️ WARNING Missing user config file: /tmp/nvim_orgmode/config/nvim/init.lua
    • ADVICE:
      • :help |config|

Runtime ~

  • ✅ OK $VIMRUNTIME: /nix/store/312935am3wdsmzcinvjqx7949panbarn-neovim-unwrapped-nightly/share/nvim/runtime

Performance ~

  • ✅ OK Build type: Release

Remote Plugins ~

  • ✅ OK Up to date

terminal ~

  • key_backspace (kbs) terminfo entry: key_backspace=\177
  • key_dc (kdch1) terminfo entry: key_dc=\E[3~
  • $TERM_PROGRAM="tmux"
  • $COLORTERM="truecolor"

tmux ~

  • ✅ OK escape-time: 1
  • ✅ OK focus-events: on
  • $TERM: foot
  • ❌ ERROR $TERM should be "screen-256color", "tmux-256color", or "tmux-direct" in tmux. Colors might look wrong.

External Tools ~

  • ✅ OK ripgrep 14.1.1 (/etc/profiles/per-user/szaffarano/bin/rg)
  • ✅ OK git version 2.51.0 (/etc/profiles/per-user/szaffarano/bin/git)
  • ✅ OK curl 8.16.0 (/run/current-system/sw/bin/curl)
    Release-Date: 2025-09-10
    Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
    Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

==============================================================================
vim.lsp: ✅

  • LSP log level : WARN
  • Log path: /tmp/nvim_orgmode/state/nvim/lsp.log
  • Log size: 0 KB

vim.lsp: Active Features ~

vim.lsp: Active Clients ~

  • No active clients

vim.lsp: Enabled Configurations ~

vim.lsp: File Watcher ~

  • file watching "(workspace/didChangeWatchedFiles)" disabled on all clients

vim.lsp: Position Encodings ~

  • No active clients

==============================================================================
vim.provider: ✅

Clipboard (optional) ~

  • ✅ OK Clipboard tool found: wl-copy

Node.js provider (optional) ~

  • Disabled (loaded_node_provider=0).

Perl provider (optional) ~

  • Disabled (loaded_perl_provider=0).

Python 3 provider (optional) ~

  • Disabled (loaded_python3_provider=0).

Ruby provider (optional) ~

  • Disabled (loaded_ruby_provider=0).

==============================================================================
vim.treesitter: ✅

Treesitter features ~

  • Treesitter ABI support: min 13, max 15
  • WASM parser support: false

Treesitter parsers ~

  • ✅ OK Parser: c ABI: 15, path: /nix/store/312935am3wdsmzcinvjqx7949panbarn-neovim-unwrapped-nightly/lib/nvim/parser/c.so
  • ✅ OK Parser: lua ABI: 15, path: /nix/store/312935am3wdsmzcinvjqx7949panbarn-neovim-unwrapped-nightly/lib/nvim/parser/lua.so
  • ✅ OK Parser: markdown ABI: 15, path: /nix/store/312935am3wdsmzcinvjqx7949panbarn-neovim-unwrapped-nightly/lib/nvim/parser/markdown.so
  • ✅ OK Parser: markdown_inline ABI: 15, path: /nix/store/312935am3wdsmzcinvjqx7949panbarn-neovim-unwrapped-nightly/lib/nvim/parser/markdown_inline.so
  • ✅ OK Parser: org ABI: 14, path: /tmp/nvim_orgmode/lazy/orgmode/parser/org.so
  • ✅ OK Parser: query ABI: 15, path: /nix/store/312935am3wdsmzcinvjqx7949panbarn-neovim-unwrapped-nightly/lib/nvim/parser/query.so
  • ✅ OK Parser: vim ABI: 15, path: /nix/store/312935am3wdsmzcinvjqx7949panbarn-neovim-unwrapped-nightly/lib/nvim/parser/vim.so
  • ✅ OK Parser: vimdoc ABI: 15, path: /nix/store/312935am3wdsmzcinvjqx7949panbarn-neovim-unwrapped-nightly/lib/nvim/parser/vimdoc.so

Steps to reproduce

  1. nvim -u /tmp/minimal_init.lua
  2. Inside nvim :Org agenda a

Expected behavior

No errors

Emacs functionality

Current week agenda view

Minimal init.lua

local tmp_dir = vim.env.TMPDIR or vim.env.TMP or vim.env.TEMP or "/tmp"
local nvim_root = tmp_dir .. "/nvim_orgmode"
local lazy_root = nvim_root .. "/lazy"
local lazypath = lazy_root .. "/lazy.nvim"

for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = nvim_root .. "/" .. name
end

-- Install lazy.nvim if not already installed
if not vim.uv.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	{
		"nvim-orgmode/orgmode",
		event = "VeryLazy",
		ft = { "org" },
		config = function()
			require("orgmode").setup({
				org_agenda_files = {
					"/tmp/test/**/*.org",
				},
			})
		end,
	},
}, {
	root = lazy_root,
	lockfile = nvim_root .. "/lazy.json",
	install = {
		missing = false,
	},
})

require("lazy").sync({
	wait = true,
	show = false,
})

Screenshots and recordings

Image

nvim-orgmode version

commit 266888a

OS / Distro

NixOS unstable

Neovim version/commit

NVIM v0.12.0-nightly+323d552

Additional context

❯ tree /tmp/test
/tmp/test
├── test-01.org
└── test-02.org

1 directory, 2 files

❯ cat /tmp/test/test-01.org 
* Test 1

❯ cat /tmp/test/test-02.org 
* Test 2
  ex: 5x 5’

*only fails when I have more than one file in /tmp/test, and only one of them have (at least) this particular text like in " Test 2". I isolated the text until it kept failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions