oraios/serena · error · ValueError

Language server for {lang_server.language_id} returned no re

Error message

Language server for {lang_server.language_id} returned no rename edits for symbol '{name_path}'. The symbol might not support renaming.

What it means

After requesting a rename from the language server (request_rename_symbol_edit), Serena expects a WorkspaceEdit back. A None result means the server refused or could not produce rename edits for that symbol, so ValueError is raised telling the caller the symbol may not support renaming.

Source

Thrown at src/serena/code_editor.py:403

        :param name_path: the name path of the symbol to rename
        :param relative_path: the relative path of the file containing the symbol.
        :param new_name: the new name
        :return: a status message
        """
        symbol = self._find_unique_symbol(name_path, relative_path)
        if not symbol.location.has_position_in_file():
            raise ValueError(f"Symbol '{name_path}' does not have a valid position in file for renaming")

        # After has_position_in_file check, line and column are guaranteed to be non-None
        assert symbol.location.line is not None
        assert symbol.location.column is not None

        lang_server = self._get_language_server(relative_path)
        rename_result = lang_server.request_rename_symbol_edit(
            relative_file_path=relative_path, line=symbol.location.line, column=symbol.location.column, new_name=new_name
        )
        if rename_result is None:
            raise ValueError(
                f"Language server for {lang_server.language_id} returned no rename edits for symbol '{name_path}'. "
                f"The symbol might not support renaming."
            )
        num_changes = self._apply_workspace_edit(rename_result)

        if num_changes == 0:
            raise ValueError(
                f"Renaming symbol '{name_path}' to '{new_name}' resulted in no changes being applied; renaming may not be supported."
            )

        msg = f"Successfully renamed '{name_path}' to '{new_name}' ({num_changes} changes applied)"
        return msg


class JetBrainsCodeEditor(CodeEditor[JetBrainsSymbol]):
    def __init__(self, project: Project) -> None:
        self._project = project
        super().__init__(project)

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Confirm the symbol is a renamable definition (class/function/variable), not a keyword or builtin
  2. Retry after the language server finishes indexing the project
  3. Test a rename in the IDE with the same server; if it also fails, the symbol is not renamable
  4. Upgrade or reconfigure the language server for the file's language

Example fix

// before: renaming a keyword-ish symbol returns None -> error
// after: pick the actual definition
editor.rename_symbol("MyClass", "src/app.py", "RenamedClass")  # definition symbol renames fine
Defensive patterns

Strategy: retry

Validate before calling

if not is_concrete_definition_symbol(name_path, rel_path):
    raise ValueError("Refusing to rename non-definition symbol")

Type guard

def supports_rename(lang_server, rel_path, line, col) -> bool:
    return lang_server.request_prepare_rename_edit(rel_path, line, col) is not None if hasattr(lang_server, 'request_prepare_rename_edit') else True

Try / catch

try:
    editor.rename_symbol(name_path, rel_path, new_name)
except ValueError as e:
    if "returned no rename edits" in str(e):
        wait_for_indexing(lang_server)
        editor.rename_symbol(name_path, rel_path, new_name)  # one retry
    else:
        raise

Prevention

When it happens

Trigger: rename_symbol on a symbol the language server cannot rename: keywords, built-ins, dynamic/anonymous constructs, or a server that returns null for prepareRename/rename on that position.

Common situations: Renaming language keywords or import aliases the server treats as non-renamable; language server misconfigured or not fully indexed; symbol resolved via name_path maps to a non-declaration (e.g. a comment/string hit).

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/46b4fc2ad491a50a. Report an issue: GitHub.