{"record":{"id":"474b9752e17f7c1f","repo":"Hmbown/CodeWhale","slug":"workspace-scope-requires-an-id","errorCode":null,"errorMessage":"workspace scope requires an id","messagePattern":"workspace scope requires an id","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/native_memory.rs","lineNumber":128,"sourceCode":"            source,\n            line_start: 0,\n            line_end: 0,\n            stale: store.freshness(access, m, snapshot)? != Freshness::Current,\n        })\n    }\n    fn access_for(&self, id: Option<&str>) -> Result<Access> {\n        Ok(Access::operator(self.scopes(id)?)?)\n    }\n    pub fn remember(\n        &self,\n        scope: MemoryScope,\n        workspace_id: Option<&str>,\n        note: &str,\n    ) -> Result<MemoryHit> {\n        let selected = match scope {\n            MemoryScope::Global => Self::owner_scope(),\n            MemoryScope::Workspace => Self::workspace_scope(\n                workspace_id.ok_or_else(|| anyhow!(\"workspace scope requires an id\"))?,\n            )?,\n        };\n        let access = Access::agent(vec![selected.clone()])?;\n        let mut store = self.open_structured()?;\n        let draft = Draft::note(\n            selected,\n            policy::excerpt(note, 80),\n            note,\n            Evidence {\n                kind: SourceKind::Agent,\n                uri: \"codewhale:native-capture\".into(),\n                locator: \"Unreviewed capture through legacy native entry point\".into(),\n                sha256: None,\n                observed_at: 0,\n            },\n        );\n        let key = format!(\"native-note:{}\", policy::sha256(note.as_bytes()));\n        let r = store.capture(&access, &key, draft)?;","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/native_memory.rs#L110-L146","documentation":"NativeMemoryStore::remember requires that when MemoryScope::Workspace is selected, a workspace_id must be supplied, because the memory scope is derived from it (workspace_scope). Passing scope = Workspace with workspace_id = None violates this contract and raises this error before any store is opened or written.","triggerScenarios":"Calling remember(scope: MemoryScope::Workspace, workspace_id: None, ...) — i.e. the tool/caller asks to save a workspace-scoped memory without providing the workspace identifier.","commonSituations":"Tool invocation (the remember tool) not passing the current workspace/project id through; caller defaulting an Option<&str> to None; invoking the tool outside any workspace context.","solutions":["Pass the current workspace id when calling remember with MemoryScope::Workspace","Use MemoryScope::Global if the note is not workspace-specific and no id is available","Fix the tool/call site to thread the workspace identifier from the session context"],"exampleFix":"// before\nmemory.remember(MemoryScope::Workspace, None, \"note\")?\n// after\nmemory.remember(MemoryScope::Workspace, Some(\"my-workspace-id\"), \"note\")?","handlingStrategy":"validation","validationCode":"if scope == MemoryScope::Workspace && workspace_id.is_none() {\n    return Err(anyhow!(\"workspace scope requires an id\")); // or fall back to Global\n}","typeGuard":null,"tryCatchPattern":"match memory.remember(scope, workspace_id, note) {\n    Err(e) if e.to_string().contains(\"workspace scope requires an id\") => {\n        memory.remember(MemoryScope::Global, None, note)\n    }\n    other => other,\n}","preventionTips":["Thread the workspace id from session context into every remember call","Default to Global scope when no workspace context is available","Validate scope/id pairing at the tool-input layer before reaching the store"],"tags":["validation","memory","arguments","workspace"],"backgroundTag":"missing-required-argument","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}