Hmbown/CodeWhale · error · anyhow::Error
workspace memory requires a git repository with an origin
Error message
workspace memory requires a git repository with an origin
What it means
Workspace-scoped native memory derives a stable workspace identity by hashing the repository's origin URL: workspace_id runs git config --get remote.origin.url in the workspace. When git exits non-zero (not a repository, or no origin remote) or the value is empty, it returns Ok(None), and workspace-scope operations like /memory native delete workspace fail with this message instead of guessing a scope.
Solutions
- Run the command from the repository root that owns the memory scope.
- Add an origin remote: git remote add origin <url> - worktrees sharing an origin share memory.
- If the remote is named differently, rename it or add origin pointing at the same URL.
- Use /memory native delete all or global when no workspace identity is intended.
Example fix
# before: repo has no origin - workspace scope cannot resolve git init /memory native delete workspace # -> requires a git repository with an origin # after: attach an origin so the workspace identity exists git remote add origin https://example.com/me/proj.git /memory native delete workspace
Defensive patterns
Strategy: validation
Validate before calling
// Rust: check workspace identity before any workspace-scope memory op
let out = std::process::Command::new("git")
.arg("-C").arg(&workspace)
.args(["config", "--get", "remote.origin.url"])
.output()?;
anyhow::ensure!(
out.status.success() && !String::from_utf8_lossy(&out.stdout).trim().is_empty(),
"no git origin - workspace memory unavailable; use global scope"
);
Type guard
fn has_workspace_identity(ws: &std::path::Path) -> bool {
std::process::Command::new("git")
.arg("-C").arg(ws)
.args(["config", "--get", "remote.origin.url"])
.output()
.map(|o| o.status.success() && !o.stdout.is_empty())
.unwrap_or(false)
}
Prevention
- Configure an origin remote immediately after git init in repos that will use workspace memory.
- Remember worktrees sharing an origin share one memory scope.
- Use the global scope in scratch directories that will never have a remote.
When it happens
Trigger: Running /memory native ... workspace outside a git repository; a repo initialized with git init but no git remote add origin; a remote named something other than origin (e.g. only upstream); a repo checked out from a bundle or by a tool that strips remotes.
Common situations: Scratch directories and temp workspaces; fresh repos before a remote is configured; CI checkouts without origin.
Related errors
- git failed
- workspace scope requires a workspace id
- workspace scope requires an id
- A full Git history is required to establish the PR merge…
- Annotated tag did not peel to a commit SHA
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/e908969072cc8f9a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/commands/groups/memory/memory.rs:203
},
"reindex" => match store.reindex() {
Ok(count) => {
CommandResult::message(format!("native memory reindexed: {count} entries"))
}
Err(err) => CommandResult::error(format!("native memory reindex failed: {err}")),
},
"delete" | "clear" => {
let scope = arg.unwrap_or("all");
let result = match scope {
"all" => store.delete_all(None, None),
"global" => store.delete_all(Some(crate::native_memory::MemoryScope::Global), None),
"workspace" => {
match crate::native_memory::NativeMemoryStore::workspace_id(&app.workspace) {
Ok(Some(id)) => store.delete_all(
Some(crate::native_memory::MemoryScope::Workspace),
Some(&id),
),
Ok(None) => Err(anyhow::anyhow!(
"workspace memory requires a git repository with an origin"
)),
Err(err) => Err(err),
}
}
_ => {
return CommandResult::error(
"Usage: /memory native delete [all|global|workspace]",
);
}
};
match result {
Ok(()) => CommandResult::message(format!("native memory {scope} deleted")),
Err(err) => CommandResult::error(format!("native memory delete failed: {err}")),
}
}
_ => CommandResult::error(
"Usage: /memory native [status|path|remember ...|import|search <query>|get <id>|export|reindex|delete]",View on GitHub (pinned to 0c42157ee5)