Skip to content

fix(api): point fresh installs at project setup when resolve finds an empty projects table#990

Merged
phernandez merged 1 commit into
mainfrom
fix/fresh-install-resolve-guidance
Jun 12, 2026
Merged

fix(api): point fresh installs at project setup when resolve finds an empty projects table#990
phernandez merged 1 commit into
mainfrom
fix/fresh-install-resolve-guidance

Conversation

@phernandez

Copy link
Copy Markdown
Member

Summary

Follow-up to #974 / #985 / #987. Those fixes repair the config/DB default during project add — but on a truly fresh install where the first action is a read (e.g. the Claude Code plugin's SessionStart brief on a new machine), no repair path runs and the user gets:

Error during read_note: Project not found: 'main'

which reads as a broken install rather than a missing first-run step. config.json bootstraps the main default in model_post_init, but the one-shot CLI path never executes the server-lifespan reconciliation that would create its database row.

Per design discussion: rather than silently reconciling on read, fail with direction. When /v2/projects/resolve misses and the projects table is empty, the 404 detail now names the setup command:

Project not found: 'main'. No projects are set up yet — run 'basic-memory project add <name> <path>' to create one.

Misses against a populated table keep the plain message, and the Project not found prefix is preserved for existing error-classification code (e.g. mcp/tools/search.py).

Test evidence

  • test_resolve_project_not_found_fresh_install_names_setup_command — fails without the fix (bare message), passes with it
  • test_resolve_project_not_found_with_projects_keeps_plain_message — populated-table miss keeps the exact plain detail
  • End-to-end repro verified: fresh BASIC_MEMORY_CONFIG_DIR/HOME + bm tool read-note now prints the guidance
  • tests/api/v2/test_project_router.py 29 passed; ruff and ty clean

Refs #974

🤖 Generated with Claude Code

… empty projects table

On a brand-new config dir, model_post_init bootstraps a 'main' default in
config.json but the one-shot CLI path never runs the server-lifespan
reconciliation that would create its database row, so the first read fails
with a bare "Project not found: 'main'" — which reads as a broken install
rather than a missing first-run step. When resolution misses and the
projects table is empty, the 404 now names the setup command.

Follow-up to #974/#985/#987 (which repair the default during project add
but cannot help when the first action is a read). Refs #974.

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez phernandez merged commit 515b2c8 into main Jun 12, 2026
23 checks passed
@phernandez phernandez deleted the fix/fresh-install-resolve-guidance branch June 12, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant