{"record":{"id":"6767ee489c85b854","repo":"AprilNEA/OpenLogi","slug":"name-must-not-be-empty","errorCode":null,"errorMessage":"--name must not be empty","messagePattern":"--name must not be empty","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/fixture/record_case.rs","lineNumber":297,"sourceCode":"    })\n}\n\npub(super) async fn capture_for_contribution(\n    operation: FixtureOperation,\n    target: &CaptureTarget,\n    name: &str,\n    channel: &str,\n    capacity: usize,\n    identity_plan: &HidCassetteIdentityPlan,\n) -> Result<HidCassette> {\n    let (recording, observation) = capture(operation, target.route(), capacity).await?;\n    let candidates = audit::sanitize_recording_with_plan(recording, name, channel, identity_plan)?;\n    replay::select_self_replaying(operation, &target.target, &observation, candidates).await\n}\n\nfn validate_metadata(args: &RecordCaseArgs) -> Result<()> {\n    if args.name.trim().is_empty() {\n        bail!(\"--name must not be empty\");\n    }\n    if args.channel.trim().is_empty() {\n        bail!(\"--channel must not be empty\");\n    }\n    Ok(())\n}\n\nasync fn acquire_capture_ownership() -> Result<InstanceGuard> {\n    // The agent acquires this same lock before any HID I/O. An endpoint probe\n    // alone misses both early startup and a relaunch after the probe returns.\n    let guard = single_instance::acquire(\"agent.lock\").context(\n        \"refusing direct fixture capture: could not acquire agent.lock; \\\n         stop the OpenLogi agent and any other fixture capture before retrying\",\n    )?;\n    match tokio::time::timeout(AGENT_PROBE_TIMEOUT, client::connect()).await {\n        Ok(Err(ConnectError::Endpoint(error))) if endpoint_is_unreachable(&error) => Ok(guard),\n        Ok(Ok(_) | Err(ConnectError::Handshake(_) | ConnectError::Endpoint(_))) | Err(_) => bail!(\n            \"refusing direct fixture capture because the agent endpoint is active or accepted a \\","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/fixture/record_case.rs#L279-L315","documentation":"`validate_metadata` rejects a `record-case` invocation whose `--name` value is empty or only whitespace, before any device I/O happens. The name identifies the recorded fixture case on disk, so an empty name is invalid.","triggerScenarios":"Invoking `openlogi fixture record-case --name \"\"` or `--name \"   \"` (e.g. a shell variable that expanded to nothing, like `--name \"$CASE_NAME\"` with CASE_NAME unset).","commonSituations":"Scripting the recorder with an unset or typo'd environment variable; piping names from a file with blank lines; forgetting the flag entirely so a default empty value is used.","solutions":["Pass a non-empty `--name` value, e.g. `--name dpi-cycle-smartshift`","In scripts, guard the variable: `: \"${CASE_NAME:?CASE_NAME must be set}\"` before invoking the CLI","Trim user-supplied names before passing them through"],"exampleFix":"// before\nopenlogi fixture record-case --name \"$CASE_NAME\"   # CASE_NAME empty\n// after\n: \"${CASE_NAME:?CASE_NAME must be set}\"\nopenlogi fixture record-case --name \"$CASE_NAME\"","handlingStrategy":"validation","validationCode":"if name.trim().is_empty() {\n    return Err(\"--name must be a non-empty fixture case name\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate CLI inputs in scripts before invoking","Use ${VAR:?msg} guards for shell variables feeding --name","Avoid interactive prompts that can submit empty names"],"tags":["cli","validation","arguments","fixture"],"backgroundTag":"empty-required-field","analyzedSha":"e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8","analyzedAt":"2026-09-13T03:07:16.451Z","contentChangedAt":"2026-09-13T03:07:16.451Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}