You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `delete_project` MCP tool was failing with "Project 'test-verify' not found" even though the project clearly existed and showed up in `list_memory_projects`.
6
+
7
+
## Root Cause
8
+
9
+
The bug was in `/Users/drew/code/basic-memory/src/basic_memory/config.py` in the `ConfigManager.remove_project()` method (line 311):
10
+
11
+
```python
12
+
defremove_project(self, name: str) -> None:
13
+
"""Remove a project from the configuration."""
14
+
15
+
project_name, path =self.get_project(name)
16
+
ifnot project_name:
17
+
raiseValueError(f"Project '{name}' not found")
18
+
19
+
config =self.load_config()
20
+
if project_name == config.default_project:
21
+
raiseValueError(f"Cannot remove the default project '{name}'")
22
+
23
+
del config.projects[name] # ← BUG: Using input name instead of found project_name
24
+
self.save_config(config)
25
+
```
26
+
27
+
**The Issue:**
28
+
1. Line 305: `get_project(name)` does a permalink-based lookup and returns the **actual** project name from the config (e.g., "test-verify")
29
+
2. Line 311: `del config.projects[name]` tries to delete using the **input** name parameter instead of the `project_name` that was just found
30
+
3. Since `get_project()` uses permalink matching, it can find a project even if the input name doesn't match the exact dictionary key
31
+
32
+
**Example Scenario:**
33
+
- Config has project key: `"test-verify"`
34
+
- User calls: `delete_project("test-verify")`
35
+
-`get_project("test-verify")` finds it via permalink matching and returns `("test-verify", "/path")`
36
+
-`del config.projects["test-verify"]` tries to delete using input, which should work...
37
+
- BUT if there's any normalization mismatch between the stored key and the input, it fails
38
+
39
+
## The Fix
40
+
41
+
Changed line 311 to use the `project_name` returned by `get_project()`:
42
+
43
+
```python
44
+
# Use the found project_name (which may differ from input name due to permalink matching)
45
+
del config.projects[project_name]
46
+
```
47
+
48
+
This ensures we're deleting the exact key that exists in the config dictionary, not the potentially non-normalized input name.
49
+
50
+
## Testing
51
+
52
+
After applying this fix, the delete operation should work correctly:
53
+
54
+
```python
55
+
# This should now succeed
56
+
await delete_project("test-verify")
57
+
```
58
+
59
+
## Related Code
60
+
61
+
The same pattern is correctly used in other methods:
62
+
-`set_default_project()` correctly uses the found `project_name` when setting default
63
+
- The API endpoint `remove_project()` in project_router.py correctly passes through to this method
64
+
65
+
## Commit Message
66
+
67
+
```
68
+
fix: use found project_name in ConfigManager.remove_project()
69
+
70
+
The remove_project() method was using the input name parameter to delete
71
+
from config.projects instead of the project_name returned by get_project().
72
+
This caused failures when the input name didn't exactly match the config
73
+
dictionary key, even though get_project() successfully found the project
74
+
via permalink matching.
75
+
76
+
Now uses the actual project_name returned by get_project() to ensure we're
0 commit comments