Skip to content

bm reindex --embeddings silently no-ops on an unsynced project (0 embedded, no warning) #1184

Description

@BigManDrewskii

Summary

On a fresh project whose files were never indexed, bm reindex --embeddings prints a success-looking 0 entities embedded, 0 skipped, 0 errors while bm status still reports pending changes and read_note returns nothing. The --embeddings path never runs the project index, and there is no hint that a sync must happen first. The docs claim embeddings are "generated automatically on first startup for existing notes" and point at bm reindex --embeddings as the manual rebuild command, which misleads CLI-first users into a silent no-op.

Reproduction (v0.22.1, CLI-only, no MCP server running)

mkdir -p ~/scratch/bm-repro/notes
cat > ~/scratch/bm-repro/notes/note.md <<'EOF'
---
title: Repro Probe Note
type: note
tags: [repro]
---

# Repro Probe Note

## Observations
- [fact] This note was written directly to disk, never via write_note.
EOF

bm project add repro-test ~/scratch/bm-repro --local
bm status --project repro-test            # → notes/ +1 new

bm reindex --embeddings -p repro-test     # → "0 entities embedded, 0 skipped, 0 errors"
bm tool read-note "notes/note" -p repro-test   # → empty

bm reindex -p repro-test                  # → project index runs; "1 entities embedded"
bm tool read-note "notes/note" -p repro-test   # → works
bm tool search-notes "probe note written to disk" -p repro-test  # → finds it

Observed:

  • bm reindex --embeddings0 entities embedded, 0 skipped, 0 errors (no warning)
  • bm status still shows +1 new afterwards
  • plain bm reindex (both flags) syncs + embeds and everything works

Root cause

In src/basic_memory/cli/commands/db.py (both v0.22.1 and current main), the embeddings branch calls search_service.reindex_vectors() against DB state only; only the search branch runs the project index (sync_service.sync(...) in v0.22.1, run_local_project_index_for_project(...) on main). The code comment on main makes the ownership split explicit: "the explicit embeddings phase below owns vector (re)builds" — the project index must run first. Nothing warns when reindex_vectors finds 0 entities.

Suggested fix (any subset)

  1. When reindex_vectors completes with total_entities == 0 (or embedded == 0 and DB was empty), print a warning: "no entities in DB — run bm reindex (project index) or start the MCP server so files get indexed first."
  2. Optionally: auto-run the project index when the DB is empty and the project has files on disk.
  3. Docs: on the semantic-search page, clarify that bm reindex --embeddings only re-embeds already-indexed entities, and that first-run indexing for CLI-only setups requires bm reindex (no flags).

Environment

  • basic-memory v0.22.1 (CLI), SQLite, semantic_search_enabled: true, FastEmbed bge-small-en-v1.5
  • macOS arm64

Related: #959 (CLI-only sync dead end, closed), #1016 (watcher-path writes not embedded until reindex, closed). This is the --embeddings-flag-specific silent no-op variant — #959's repro used plain bm reindex which works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions