serena icon indicating copy to clipboard operation
serena copied to clipboard

zls: no rename edits for symbol

Open dennypenta opened this issue 1 month ago • 3 comments

Why do I think it's a bug

  1. nvim lsp client is able to rename it
  2. others lsp mcps are able to rename it (they don't support workspace edit, but can do in the fine where the symbol is defined)

How to reproduce

invoke rename tool in zig project

serena - rename_symbol (MCP)(name_path: "Block", relative_path: "src/store/inmem/block.zig", new_name: "RawBlock") ⎿ { "result": "Error executing tool: ValueError - Language server for zig returned no rename edits for symbol 'Block'. The symbol might not support renaming." }

Link to the project where it happened

https://github.com/seqor/seqor

zls version

0.15.0

logs

Programming languages: zig; file encoding: utf-8
INFO  2025-12-01 20:12:46,503 [MainThread] serena.cli:start_mcp_server:193 - Starting MCP server …
INFO  2025-12-01 20:12:46,528 [MainThread] serena.mcp:_set_mcp_tools:240 - Starting MCP server with 21 tools: ['list_dir', 'find_file', 'search_for_pattern', 'get_symbols_overview', 'find_symbol', 'find_referencing_symbols', 'replace_symbol_body', 'insert_after_symbol', 'insert_before_symbol', 'rename_symbol', 'write_memory', 'read_memory', 'list_memories', 'delete_memory', 'edit_memory', 'check_onboarding_performed', 'onboarding', 'think_about_collected_information', 'think_about_task_adherence', 'think_about_whether_you_are_done', 'initial_instructions']
INFO  2025-12-01 20:12:46,528 [MainThread] serena.mcp:server_lifespan:347 - MCP server lifetime setup complete
INFO  2025-12-01 20:12:46,534 [MainThread] mcp.server.lowlevel.server:_handle_request:625 - Processing request of type ListToolsRequest
INFO  2025-12-01 20:12:46,535 [MainThread] mcp.server.lowlevel.server:_handle_request:625 - Processing request of type ListPromptsRequest
INFO  2025-12-01 20:12:46,536 [MainThread] mcp.server.lowlevel.server:_handle_request:625 - Processing request of type ListResourcesRequest
INFO  2025-12-01 20:13:38,889 [MainThread] mcp.server.lowlevel.server:_handle_request:625 - Processing request of type CallToolRequest
INFO  2025-12-01 20:13:38,890 [MainThread] serena.task_executor:issue_task:192 - Scheduling Task-2:RenameSymbolTool
INFO  2025-12-01 20:13:38,975 [SerenaAgentTaskExecutor] serena.task_executor:_process_task_queue:123 - Starting execution of Task-2:RenameSymbolTool
INFO  2025-12-01 20:13:38,975 [Task-2:RenameSymbolTool] serena.task_executor:start:360 - Task-2:RenameSymbolTool starting ...
INFO  2025-12-01 20:13:38,976 [Task-2:RenameSymbolTool] serena.tools.tools_base:_log_tool_application:206 - rename_symbol: name_path='Block', relative_path='src/store/inmem/block.zig', new_name='RawBlock'
ERROR 2025-12-01 20:13:38,982 [Task-2:RenameSymbolTool] serena.tools.tools_base:task:275 - Error executing tool: Language server for zig returned no rename edits for symbol 'Block'. The symbol might not support renaming.
Traceback (most recent call last):
  File "/theuser/.local/share/uv/tools/serena-agent/lib/python3.13/site-packages/serena/tools/tools_base.py", line 250, in task
    result = apply_fn(**kwargs)
  File "/theuser/.local/share/uv/tools/serena-agent/lib/python3.13/site-packages/serena/tools/symbol_tools.py", line 309, in apply
    status_message = code_editor.rename_symbol(name_path, relative_file_path=relative_path, new_name=new_name)
  File "/theuser/.local/share/uv/tools/serena-agent/lib/python3.13/site-packages/serena/code_editor.py", line 314, in rename_symbol
    raise ValueError(
    ...<2 lines>...
    )
ValueError: Language server for zig returned no rename edits for symbol 'Block'. The symbol might not support renaming.
INFO  2025-12-01 20:13:38,984 [Task-2:RenameSymbolTool] serena.tools.tools_base:task:279 - Result: Error executing tool: ValueError - Language server for zig returned no rename edits for symbol 'Block'. The symbol might not support renaming.
INFO  2025-12-01 20:13:38,984 [Task-2:RenameSymbolTool] serena.task_executor:stop:367 - Task-2:RenameSymbolTool completed in 0.009 seconds

connect in the claude code using mcp add ..., resulted in the following config:

      "mcpServers": {
        "serena": {
          "type": "stdio",
          "command": "serena",
          "args": [
            "start-mcp-server",
            "--context",
            "ide-assistant",
            "--project",
            "/theuser/projects/seqor"
          ],
          "env": {}
        }
      },

serena project health-check

INFO  2025-12-01 20:05:37,300 serena.util.file_system:start:360 - Loading of .gitignore files starting ...
INFO  2025-12-01 20:05:37,300 serena.util.file_system:_load_gitignore_files:148 - Processing .gitignore file: /theuser/projects/seqor/.gitignore
INFO  2025-12-01 20:05:37,300 serena.util.file_system:_load_gitignore_files:148 - Processing .gitignore file: /theuser/projects/seqor/.serena/.gitignore
INFO  2025-12-01 20:05:37,301 serena.util.file_system:stop:367 - Loading of .gitignore files completed in 0.001 seconds
INFO  2025-12-01 20:05:37,301 sensai.util.logging:add_file_logger:189 - Logging to /theuser/projects/seqor/.serena/logs/health-checks/health_check_20251201-200537.log ...
INFO  2025-12-01 20:05:37,301 serena.cli:health_check:632 - Starting health check for project: /theuser/projects/seqor
INFO  2025-12-01 20:05:37,301 serena.cli:health_check:636 - Creating SerenaAgent with disabled dashboard...
INFO  2025-12-01 20:05:37,302 serena.agent:__init__:222 - Will record tool usage statistics with token count estimator: CHAR_COUNT.
INFO  2025-12-01 20:05:37,368 serena.agent:__init__:226 - Starting Serena server (version=0.1.4-3092576e-dirty, process id=18730, parent process id=16331)
INFO  2025-12-01 20:05:37,368 serena.agent:__init__:227 - Configuration file: None
INFO  2025-12-01 20:05:37,368 serena.agent:__init__:228 - Available projects: 
INFO  2025-12-01 20:05:37,369 serena.agent:__init__:229 - Loaded tools (38): read_file, create_text_file, list_dir, find_file, replace_content, delete_lines, replace_lines, insert_at_line, search_for_pattern, restart_language_server, get_symbols_overview, find_symbol, find_referencing_symbols, replace_symbol_body, insert_after_symbol, insert_before_symbol, rename_symbol, write_memory, read_memory, list_memories, delete_memory, edit_memory, execute_shell_command, activate_project, remove_project, switch_modes, get_current_config, check_onboarding_performed, onboarding, think_about_collected_information, think_about_task_adherence, think_about_whether_you_are_done, summarize_changes, prepare_for_new_conversation, initial_instructions, jet_brains_find_symbol, jet_brains_find_referencing_symbols, jet_brains_get_symbols_overview
INFO  2025-12-01 20:05:37,369 serena.agent:apply:126 - SerenaAgentContext[name='desktop-app'] included 1 tools: switch_modes
INFO  2025-12-01 20:05:37,369 serena.agent:__init__:243 - Number of exposed tools: 29
INFO  2025-12-01 20:05:37,382 serena.agent:_update_active_tools:477 - Active tools (29): activate_project, check_onboarding_performed, create_text_file, delete_memory, edit_memory, execute_shell_command, find_file, find_referencing_symbols, find_symbol, get_current_config, get_symbols_overview, initial_instructions, insert_after_symbol, insert_before_symbol, list_dir, list_memories, onboarding, prepare_for_new_conversation, read_file, read_memory, rename_symbol, replace_content, replace_symbol_body, search_for_pattern, switch_modes, think_about_collected_information, think_about_task_adherence, think_about_whether_you_are_done, write_memory
INFO  2025-12-01 20:05:37,384 serena.util.file_system:start:360 - Loading of .gitignore files starting ...
INFO  2025-12-01 20:05:37,384 serena.util.file_system:_load_gitignore_files:148 - Processing .gitignore file: /theuser/projects/seqor/.gitignore
INFO  2025-12-01 20:05:37,385 serena.util.file_system:_load_gitignore_files:148 - Processing .gitignore file: /theuser/projects/seqor/.serena/.gitignore
INFO  2025-12-01 20:05:37,385 serena.util.file_system:stop:367 - Loading of .gitignore files completed in 0.001 seconds
INFO  2025-12-01 20:05:37,385 serena.agent:load_project_from_path_or_name:544 - Added new project seqor for path /theuser/projects/seqor
INFO  2025-12-01 20:05:37,385 serena.agent:_activate_project:514 - Activating seqor at /theuser/projects/seqor
INFO  2025-12-01 20:05:37,385 serena.agent:_update_active_tools:477 - Active tools (29): activate_project, check_onboarding_performed, create_text_file, delete_memory, edit_memory, execute_shell_command, find_file, find_referencing_symbols, find_symbol, get_current_config, get_symbols_overview, initial_instructions, insert_after_symbol, insert_before_symbol, list_dir, list_memories, onboarding, prepare_for_new_conversation, read_file, read_memory, rename_symbol, replace_content, replace_symbol_body, search_for_pattern, switch_modes, think_about_collected_information, think_about_task_adherence, think_about_whether_you_are_done, write_memory
INFO  2025-12-01 20:05:37,385 serena.task_executor:issue_task:192 - Scheduling Task-1:init_language_server_manager
INFO  2025-12-01 20:05:37,385 serena.cli:health_check:639 - SerenaAgent created successfully
INFO  2025-12-01 20:05:37,385 serena.cli:health_check:642 - Searching for analyzable files...
INFO  2025-12-01 20:05:37,387 serena.cli:health_check:651 - Found analyzable file: build.zig.zon
INFO  2025-12-01 20:05:37,387 serena.cli:health_check:669 - Testing GetSymbolsOverviewTool on file: build.zig.zon
INFO  2025-12-01 20:05:37,387 serena.task_executor:issue_task:192 - Scheduling Task-2:<lambda>
INFO  2025-12-01 20:05:37,475 serena.task_executor:_process_task_queue:123 - Starting execution of Task-1:init_language_server_manager
INFO  2025-12-01 20:05:37,475 serena.task_executor:start:360 - Task-1:init_language_server_manager starting ...
INFO  2025-12-01 20:05:37,475 serena.agent:start:360 - Language server initialization starting ...
INFO  2025-12-01 20:05:37,475 serena.project:create_language_server_manager:384 - Creating language server manager for /theuser/projects/seqor
INFO  2025-12-01 20:05:37,475 sensai.util.logging:start:360 - Language server startup (language=zig) starting ...
INFO  2025-12-01 20:05:37,475 serena.ls_manager:create_language_server:40 - Creating language server instance for /theuser/projects/seqor, language=zig.
INFO  2025-12-01 20:05:37,578 solidlsp.ls:_load_raw_document_symbols_cache:1725 - Loading document symbols cache from /theuser/projects/seqor/.serena/cache/zig/raw_document_symbols.pkl
INFO  2025-12-01 20:05:37,579 solidlsp.ls:_load_raw_document_symbols_cache:1730 - Loaded 25 entries from raw document symbols cache.
INFO  2025-12-01 20:05:37,579 solidlsp.ls:_load_document_symbols_cache:1760 - Loading document symbols cache from /theuser/projects/seqor/.serena/cache/zig/document_symbols.pkl
INFO  2025-12-01 20:05:37,580 solidlsp.ls:_load_document_symbols_cache:1765 - Loaded 24 entries from document symbols cache.
INFO  2025-12-01 20:05:37,580 solidlsp.ls:start:1857 - Starting language server with language zig for /theuser/projects/seqor
INFO  2025-12-01 20:05:37,580 solidlsp.language_servers.zls:_start_server:202 - Starting ZLS server process
INFO  2025-12-01 20:05:37,580 solidlsp.ls_handler:start:194 - Starting language server process via command: zls
INFO  2025-12-01 20:05:37,583 solidlsp.language_servers.zls:_start_server:206 - Sending initialize request from LSP client to LSP server and awaiting response
INFO  2025-12-01 20:05:37,591 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': "Starting ZLS      0.15.0 @ 'zls'"}
INFO  2025-12-01 20:05:37,591 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': 'Log File:         /theuser/Library/Caches/zls/zls.log (info)'}
INFO  2025-12-01 20:05:37,591 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 5, 'message': "Offset Encoding:  'utf-16'"}
INFO  2025-12-01 20:05:37,591 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': 'added Workspace Folder: file:///theuser/projects/seqor'}
INFO  2025-12-01 20:05:37,591 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 5, 'message': "Dynamically registering method 'workspace/didChangeConfiguration'"}
INFO  2025-12-01 20:05:37,592 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 1, 'message': "Error response for 'i_haz_configuration': .method_not_found, method 'workspace/configuration' not handled on client."}
INFO  2025-12-01 20:05:37,592 solidlsp.language_servers.zls:_start_server:239 - Opened build.zig to provide project context to ZLS
INFO  2025-12-01 20:05:37,592 sensai.util.logging:stop:367 - Language server startup (language=zig) completed in 0.117 seconds
INFO  2025-12-01 20:05:37,592 serena.agent:stop:367 - Language server initialization completed in 0.117 seconds
INFO  2025-12-01 20:05:37,592 serena.task_executor:stop:367 - Task-1:init_language_server_manager completed in 0.117 seconds
INFO  2025-12-01 20:05:37,592 serena.task_executor:_process_task_queue:123 - Starting execution of Task-2:<lambda>
INFO  2025-12-01 20:05:37,592 serena.task_executor:start:360 - Task-2:<lambda> starting ...
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': "Set config option 'enable_build_on_save' to true"}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': 'Set config option \'build_on_save_args\' to ["build"]'}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': 'Set config option \'builtin_path\' to "/theuser/Library/Caches/zls/builtin.zig"'}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': 'Set config option \'zig_lib_path\' to "/opt/homebrew/Cellar/zig/0.15.1/lib/zig"'}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': 'Set config option \'zig_exe_path\' to "/opt/homebrew/bin/zig"'}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': 'Set config option \'build_runner_path\' to "/theuser/Library/Caches/zls/build_runner/cf46548b062a7e79e448e80c05616097/build_runner.zig"'}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': 'Set config option \'global_cache_path\' to "/theuser/Library/Caches/zls"'}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': "trying to start Build-On-Save for 'file:///theuser/projects/seqor'"}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 2, 'message': "'enable_build_on_save' is ignored because it is not supported by your editor"}
INFO  2025-12-01 20:05:37,653 solidlsp.language_servers.zls:window_log_message:192 - LSP: window/logMessage: {'type': 3, 'message': "Loaded build file 'file:///theuser/projects/seqor/build.zig'"}
WARNING 2025-12-01 20:05:37,653 solidlsp.ls:request_document_symbols:1001 - Received None response from the Language Server for document symbols in build.zig.zon. This means the language server can't understand this file (possibly due to syntax errors). It may also be due to a bug or misconfiguration of the LS. Returning empty list
INFO  2025-12-01 20:05:37,653 serena.task_executor:stop:367 - Task-2:<lambda> completed in 0.061 seconds
INFO  2025-12-01 20:05:37,653 serena.cli:health_check:672 - GetSymbolsOverviewTool returned 0 symbols
ERROR 2025-12-01 20:05:37,654 serena.cli:health_check:675 - No symbols found in file build.zig.zon
❌ Health check failed: No symbols found in target file
Log saved to: /theuser/projects/seqor/.serena/logs/health-checks/health_check_20251201-200537.log
Log saved to: /theuser/projects/seqor/.serena/logs/health-checks/health_check_20251201-200537.log

dennypenta avatar Dec 01 '25 19:12 dennypenta

This is, most likely, a limitation of ZLS, not Serena. The Zig language server tests currently do not include a test of the rename function, so it is not clear to me which renames it actually supports. In general, the ZLS GitHub page lists "rename symbol" as a supported function, however, so it is reasonable to offer the function (because if it works, it is much faster; if it doesn't, the LLM can resort to low-level methods).

Note that a rename can be performed in several ways. The fact that other tools can, in principle, rename a symbol, is not proof that ZLS can do it correctly for the case you have tested. (LLM+Serena, too, can do it in a low-level fashion, for example - without relying on ZLS.)

opcode81 avatar Dec 01 '25 20:12 opcode81

sorry Im struggling to follow. The client itself if able to work and reliable, I use zls for a while for renaming. Anything I can do to provide more info or debug it to find something? specific code locations would be useful.

dennypenta avatar Dec 02 '25 06:12 dennypenta

You could have a look at the ZLS implementation in Serena, which just configures and starts the server. It might be just a configuration issue that's easy to fix, like enabling the capability in the initial config

MischaPanch avatar Dec 02 '25 10:12 MischaPanch