{"record":{"id":"f6009b36a0dc7e45","repo":"tinyhumansai/openhuman","slug":"namespace-is-required-for-clear","errorCode":null,"errorMessage":"--namespace is required for clear","messagePattern":"--namespace is required for clear","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/memory_cli.rs","lineNumber":418,"sourceCode":"    while i < args.len() {\n        match args[i].as_str() {\n            \"--namespace\" | \"-n\" => {\n                namespace = Some(next_arg(args, &mut i, \"--namespace\")?);\n            }\n            \"-v\" | \"--verbose\" => {\n                verbose = true;\n                i += 1;\n            }\n            \"-h\" | \"--help\" => {\n                println!(\"Usage: openhuman memory clear --namespace <ns> [-v]\");\n                return Ok(());\n            }\n            other => return Err(anyhow::anyhow!(\"unknown clear arg: {other}\")),\n        }\n    }\n\n    let namespace =\n        namespace.ok_or_else(|| anyhow::anyhow!(\"--namespace is required for clear\"))?;\n\n    crate::core::logging::init_for_cli_run(verbose, crate::core::logging::CliLogDefault::Global);\n\n    let rt = tokio::runtime::Builder::new_multi_thread()\n        .enable_all()\n        .build()?;\n\n    rt.block_on(async {\n        let client = create_memory_client(\"clear\").await?;\n        client\n            .clear_namespace(&namespace)\n            .await\n            .map_err(anyhow::Error::msg)?;\n        eprintln!(\"[memory:cli] namespace '{namespace}' cleared\");\n        Ok::<_, anyhow::Error>(())\n    })?;\n\n    Ok(())","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/core/memory_cli.rs#L400-L436","documentation":"Post-parse required-argument check in `openhuman memory clear`. The namespace is optional while parsing and unwrapped afterwards; without it the command refuses to run because clear is destructive and must be scoped to an explicit namespace — it will never clear everything by default.","triggerScenarios":"Thrown at src/core/memory_cli.rs:418 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Specify the target: `openhuman memory clear --namespace <ns>`.","List namespaces with `openhuman memory namespaces` to pick the right one.","Add -v to get confirmation output once the namespace is supplied."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}