Hmbown/CodeWhale · error

workspace scope requires an id

Error message

workspace scope requires an id

What it means

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.

Solutions

  1. Pass the current workspace id when calling remember with MemoryScope::Workspace
  2. Use MemoryScope::Global if the note is not workspace-specific and no id is available
  3. Fix the tool/call site to thread the workspace identifier from the session context

Example fix

// before
memory.remember(MemoryScope::Workspace, None, "note")?
// after
memory.remember(MemoryScope::Workspace, Some("my-workspace-id"), "note")?
Defensive patterns

Strategy: validation

Validate before calling

if scope == MemoryScope::Workspace && workspace_id.is_none() {
    return Err(anyhow!("workspace scope requires an id")); // or fall back to Global
}

Try / catch

match memory.remember(scope, workspace_id, note) {
    Err(e) if e.to_string().contains("workspace scope requires an id") => {
        memory.remember(MemoryScope::Global, None, note)
    }
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/474b9752e17f7c1f. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/native_memory.rs:128

            source,
            line_start: 0,
            line_end: 0,
            stale: store.freshness(access, m, snapshot)? != Freshness::Current,
        })
    }
    fn access_for(&self, id: Option<&str>) -> Result<Access> {
        Ok(Access::operator(self.scopes(id)?)?)
    }
    pub fn remember(
        &self,
        scope: MemoryScope,
        workspace_id: Option<&str>,
        note: &str,
    ) -> Result<MemoryHit> {
        let selected = match scope {
            MemoryScope::Global => Self::owner_scope(),
            MemoryScope::Workspace => Self::workspace_scope(
                workspace_id.ok_or_else(|| anyhow!("workspace scope requires an id"))?,
            )?,
        };
        let access = Access::agent(vec![selected.clone()])?;
        let mut store = self.open_structured()?;
        let draft = Draft::note(
            selected,
            policy::excerpt(note, 80),
            note,
            Evidence {
                kind: SourceKind::Agent,
                uri: "codewhale:native-capture".into(),
                locator: "Unreviewed capture through legacy native entry point".into(),
                sha256: None,
                observed_at: 0,
            },
        );
        let key = format!("native-note:{}", policy::sha256(note.as_bytes()));
        let r = store.capture(&access, &key, draft)?;

View on GitHub (pinned to 73e0f67d83)