Skip to content

Bug: rename and batch remove on a viewed index crash with SIGBUS #835

Closed as not planned

Description

@FunHenaXTV

Describe the bug

On an index opened with view, rename and remove with a list of keys crash the process with SIGBUS. Single-key remove and add correctly return "immutable index" errors.

The cause is in include/usearch/index_dense.hpp. Single-key remove checks typed_->is_immutable() (line 1649, added for #506). rename (line 1734) and the batch remove(begin, end) (line 1689) don't, so they write the new key into the read-only mapping.

Steps to reproduce

import numpy as np
from usearch.index import Index

index = Index(ndim=4, metric="l2sq")
index.add(np.arange(5), np.eye(5, 4, dtype=np.float32))
index.save("view.usearch")

view = Index.restore("view.usearch", view=True)
view.remove(1)             # ValueError: Can't remove from an immutable index
view.rename(2, 200)   # Fatal Python error: Bus error
# view.remove([1, 2])  # same crash

Expected behavior

The same error that single-key remove raises ("Can't remove from an immutable index"), with the index unchanged.

USearch version

v2.26.6

Operating System

macOS 26 (Apple clang 21, Python 3.11)

Hardware architecture

Arm

Which interface are you using?

C++ implementation

Contact Details

No response

Are you open to being tagged as a contributor?

  • I am open to being mentioned in the project .git history as a contributor

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    bug
    on Nov 4, 2026
  2. ashvardanian commented on Nov 14, 2026

    @ashvardanian
    Member

    @FunHenaXTV, thanks for the report and the fix in #838! 3.0 has no rename or removal yet, on views or anywhere else, so this crash went with the 2.x code. Removal comes back in #846 as an exclusive operation that renumbers and reclaims, and views refuse it outright, so I'm closing this in its favor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions