Hmbown/CodeWhale · error
workspace memory requires a git repository with an origin
Error message
workspace memory requires a git repository with an origin
What it means
/memory native delete workspace needs a workspace identity derived from the git origin URL (NativeMemoryStore::workspace_id). When the directory is not a git repository or has no origin remote, workspace_id returns Ok(None) and the command refuses (crates/tui/src/commands/groups/memory/memory.rs:203) rather than deleting the wrong scope or nothing silently.
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 8880682c63)
Solutions
- Add an origin remote so the workspace id resolves: git remote add origin <url>, then retry
- Or delete scopes that do not need git: /memory native delete all or /memory native delete global
- Confirm with git remote get-url origin run in the exact directory the TUI started in
Example fix
# before mkdir my-notes && cd my-notes && git init # no origin remote -> /memory native delete workspace fails # after git remote add origin https://example.com/me/my-notes.git # /memory native delete workspace now resolves the workspace id
Defensive patterns
Strategy: validation
Validate before calling
// Run before any workspace-scoped memory operation
fn has_git_origin(dir: &Path) -> bool {
std::process::Command::new("git")
.args(["remote", "get-url", "origin"])
.current_dir(dir)
.output()
.is_ok_and(|o| o.status.success())
} Try / catch
// Catch and fall back to a scope that needs no git identity
match delete_workspace_memory() {
Err(e) if e.to_string().contains("requires a git repository") => {
delete_global_memory().await?; // or prompt the user to add origin
}
r => r?,
} Prevention
- Initialize repos with an origin before relying on workspace-scoped memory
- In scripts, check git remote get-url origin before launching the TUI
- Remember only all/global scopes are git-independent
When it happens
Trigger: Running /memory native delete workspace in a folder that was never git-init'd, a repo cloned without remotes, git remote remove origin having been run, or launching the TUI from outside the intended repo.
Common situations: Scripts or scratch directories in $TMP; repos distributed as tarballs; CI checkouts with remotes stripped; new projects before the first push.
Related errors
- expected revision must be an exact 40-character Git SHA
- No saved sessions found for workspace {}. Use `codewhale ses
- workspace scope requires a workspace id
- ${name} is unavailable in Workflow scripts: runs must be det
- new Date()/Date() is unavailable in Workflow scripts: runs m
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/e908969072cc8f9a.
Report an issue: GitHub.