Skip to content

Multi-vault registry: 'same path, different name' should be alias, not conflict #2

Description

@kpachhai

Summary

When the per-user vault config (~/.config/engram/config.yaml) registers a vault under name X, and the per-vault config (<path>/engram.config.yaml) declares vault_name: Y for the SAME path, the multivault registry treats them as two separate mount requests for the same vault and raises:

VaultError: a primary vault is already mounted: 'Y'; refusing to mount 'X' also as primary

For single-vault setups (the common case) where the per-user name: is naturally an alias for the same vault, this is a false positive: there is one vault, the user wants to refer to it by two names, the registry should accept that.

Reproduction

# ~/.config/engram/config.yaml
default_user: someuser
vaults:
  - name: alias-name    # alias chosen by user
    path: ~/my-vault
    role: primary
# ~/my-vault/engram.config.yaml
vault_name: canonical-name    # vault's own name
$ engram serve
ERROR: VaultError: a primary vault is already mounted: 'canonical-name';
refusing to mount 'alias-name' also as primary

Expected

Multivault registry should detect "same resolved path, different name" before the conflict check fires and:

  • Treat the second mount request as an alias of the first
  • Register the alias name as a lookup key pointing to the same vault state
  • Log at INFO level "registering 'alias-name' as alias of 'canonical-name' (same path)"

The "refusing to mount" error should only fire when the two mount requests resolve to DIFFERENT paths, which is the actual misconfiguration this guard exists to catch.

Location

src/engram/multivault/registry.py:121 (the raise VaultError line). The fix likely belongs in registry.mount() before the conflict check.

Context

Surfaced during the same 2026-05-16 daemon-fix session. Workaround was to align the two names (which works for single-vault setups but loses the alias affordance). Per the related issue (vault-name-mismatch doctor check), this same misconfig produces the misleading "run 'engram doctor'" hint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions