oraios/serena · error · ValueError

Renaming symbol '{name_path}' to '{new_name}' resulted in no

Error message

Renaming symbol '{name_path}' to '{new_name}' resulted in no changes being applied; renaming may not be supported.

What it means

The language server returned a rename WorkspaceEdit, but after applying it via _apply_workspace_edit, zero change operations were produced. Serena raises ValueError because a successful rename should modify at least one occurrence; zero edits means renaming likely is not supported for this symbol.

Source

Thrown at src/serena/code_editor.py:410

            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)

    class EditedFile(CodeEditor.EditedFile):
        def __init__(self, relative_path: str, project: Project):
            super().__init__(relative_path)
            path = os.path.join(project.project_root, relative_path)
            log.info("Editing file: %s", path)
            self._content = FileProxy.from_project_relative_path(project, relative_path).get_contents()

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Verify the symbol is a concrete definition and rename it directly in the IDE to confirm server behavior
  2. Check that the file being edited is inside the project and not excluded by Serena ignore rules
  3. Restart/upgrade the language server; empty rename results are often a server bug
  4. Fall back to a manual text search-and-replace for the symbol name

Example fix

// before: server returns WorkspaceEdit with changes={} -> 0 operations
// after: rename a supported definition symbol
editor.rename_symbol("MyClass.my_method", "src/app.py", "renamed_method")
Defensive patterns

Strategy: fallback

Validate before calling

# smoke-test the server's rename support on a temp file first
result = lang_server.request_rename_symbol_edit(tmp_path, 0, 0, "x")
assert result is not None and (result.changes or result.documentChanges)

Type guard

def workspace_edit_nonempty(edit) -> bool:
    if edit is None:
        return False
    return bool(edit.changes or getattr(edit, "documentChanges", None))

Try / catch

try:
    editor.rename_symbol(name_path, rel_path, new_name)
except ValueError as e:
    if "no changes being applied" in str(e):
        manual_search_replace(rel_path, name_path, new_name)  # fallback
    else:
        raise

Prevention

When it happens

Trigger: rename_symbol where the server responds with an empty WorkspaceEdit (no documentChanges/changes), or its edits map to zero applicable operations in _workspace_edit_to_edit_operations.

Common situations: Servers that acknowledge rename with an empty edit for non-renamable targets; edits targeting files Serena filters out; server version quirks returning empty change maps instead of null.

Related errors


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