{"record":{"id":"e908969072cc8f9a","repo":"Hmbown/CodeWhale","slug":"workspace-memory-requires-a-git-repository-with-an","errorCode":null,"errorMessage":"workspace memory requires a git repository with an origin","messagePattern":"workspace memory requires a git repository with an origin","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/commands/groups/memory/memory.rs","lineNumber":203,"sourceCode":"        },\n        \"reindex\" => match store.reindex() {\n            Ok(count) => {\n                CommandResult::message(format!(\"native memory reindexed: {count} entries\"))\n            }\n            Err(err) => CommandResult::error(format!(\"native memory reindex failed: {err}\")),\n        },\n        \"delete\" | \"clear\" => {\n            let scope = arg.unwrap_or(\"all\");\n            let result = match scope {\n                \"all\" => store.delete_all(None, None),\n                \"global\" => store.delete_all(Some(crate::native_memory::MemoryScope::Global), None),\n                \"workspace\" => {\n                    match crate::native_memory::NativeMemoryStore::workspace_id(&app.workspace) {\n                        Ok(Some(id)) => store.delete_all(\n                            Some(crate::native_memory::MemoryScope::Workspace),\n                            Some(&id),\n                        ),\n                        Ok(None) => Err(anyhow::anyhow!(\n                            \"workspace memory requires a git repository with an origin\"\n                        )),\n                        Err(err) => Err(err),\n                    }\n                }\n                _ => {\n                    return CommandResult::error(\n                        \"Usage: /memory native delete [all|global|workspace]\",\n                    );\n                }\n            };\n            match result {\n                Ok(()) => CommandResult::message(format!(\"native memory {scope} deleted\")),\n                Err(err) => CommandResult::error(format!(\"native memory delete failed: {err}\")),\n            }\n        }\n        _ => CommandResult::error(\n            \"Usage: /memory native [status|path|remember ...|import|search <query>|get <id>|export|reindex|delete]\",","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/commands/groups/memory/memory.rs#L185-L221","documentation":"/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.","triggerScenarios":"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.","commonSituations":"Scripts or scratch directories in $TMP; repos distributed as tarballs; CI checkouts with remotes stripped; new projects before the first push.","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"],"exampleFix":"# before\nmkdir my-notes && cd my-notes && git init\n# no origin remote -> /memory native delete workspace fails\n\n# after\ngit remote add origin https://example.com/me/my-notes.git\n# /memory native delete workspace now resolves the workspace id\n","handlingStrategy":"validation","validationCode":"// Run before any workspace-scoped memory operation\nfn has_git_origin(dir: &Path) -> bool {\n    std::process::Command::new(\"git\")\n        .args([\"remote\", \"get-url\", \"origin\"])\n        .current_dir(dir)\n        .output()\n        .is_ok_and(|o| o.status.success())\n}","typeGuard":null,"tryCatchPattern":"// Catch and fall back to a scope that needs no git identity\nmatch delete_workspace_memory() {\n    Err(e) if e.to_string().contains(\"requires a git repository\") => {\n        delete_global_memory().await?; // or prompt the user to add origin\n    }\n    r => r?,\n}","preventionTips":["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"],"tags":["memory","git","workspace","cli"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}