From f90683ef8442fe9ad252ba800dcc1996835261ee Mon Sep 17 00:00:00 2001 From: Edouard Gouilliard Date: Mon, 8 Jun 2026 18:00:35 +0100 Subject: [PATCH] Fix swapped args in share_cube_with_user -> _validate_cube_access share_cube_with_user(cube_id, target_user_id) passed args to _validate_cube_access(user_id, cube_id) in the wrong order, raising "User '' does not exist" for every well-formed call. Per the in-code comment ("Validate current user has access to this cube"), the validation should check the *current* (sharing) user has access -- not the target -- so the fix uses self.user_id instead of target_user_id. The target's existence is already validated on the next line via user_manager.validate_user(target_user_id). Fixes #1901 --- src/memos/mem_os/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memos/mem_os/core.py b/src/memos/mem_os/core.py index 54f8f01e0..3ede965d3 100644 --- a/src/memos/mem_os/core.py +++ b/src/memos/mem_os/core.py @@ -1170,7 +1170,7 @@ def share_cube_with_user(self, cube_id: str, target_user_id: str) -> bool: bool: True if successful, False otherwise. """ # Validate current user has access to this cube - self._validate_cube_access(cube_id, target_user_id) + self._validate_cube_access(self.user_id, cube_id) # Validate target user exists if not self.user_manager.validate_user(target_user_id):