{"record":{"id":"f105e40bf68b6f23","repo":"AprilNEA/OpenLogi","slug":"name-must-be-a-nonempty-synthetic-device-name","errorCode":null,"errorMessage":"--name must be a nonempty synthetic device name","messagePattern":"--name must be a nonempty synthetic device name","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/fixture/contribute.rs","lineNumber":456,"sourceCode":"        bail!(\n            \"the selected direct-capture target does not match the profile transport and slot; \\\n             reconnect the same device and use the same --device selector\"\n        )\n    }\n}\n\nfn validate_args(args: &ContributeArgs) -> Result<()> {\n    if args.id.trim().is_empty() || matches!(args.id.as_str(), \".\" | \"..\") {\n        bail!(\"--id must be a nonempty synthetic path component\");\n    }\n    if Path::new(&args.id).file_name() != Some(OsStr::new(&args.id))\n        || args.id.contains('/')\n        || args.id.contains('\\\\')\n    {\n        bail!(\"--id must be one synthetic path component without separators\");\n    }\n    if args.name.trim().is_empty() {\n        bail!(\"--name must be a nonempty synthetic device name\");\n    }\n    if args.output.file_name() != Some(OsStr::new(&args.id)) {\n        bail!(\"--output directory name must exactly equal --id\");\n    }\n    Ok(())\n}\n\nfn validate_state(args: &ContributeArgs, state: &ContributionState) -> Result<()> {\n    if state.version != STATE_VERSION {\n        bail!(\"unsupported contribution state version {}\", state.version);\n    }\n    if state.fixture_id != args.id\n        || state.profile_id != format!(\"{}-profile\", args.id)\n        || state.profile_name != args.name\n    {\n        bail!(\"--id and --name must match the in-progress contribution\");\n    }\n    Ok(())","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/fixture/contribute.rs#L438-L474","documentation":"The synthetic device name given via `--name` must be nonempty after trimming whitespace. The name is stored in the fixture profile metadata, so an empty or whitespace-only name is rejected in `validate_args`.","triggerScenarios":"Run contribute with `--name \"\"` or `--name \"   \"`, typically from an unset or whitespace shell variable or a template left unfilled.","commonSituations":"Scripted fixture generation where the display-name variable was never set; batch renaming where some entries lost their name field.","solutions":["Pass a real device name, e.g. `--name \"MX Master 3S\"`.","Guard in shell: `NAME=\"${NAME:?--name is required}\"` before invoking.","If names come from a data file, validate the name column is non-blank before looping over contribute calls."],"exampleFix":"// before\nopenlogi fixture contribute --id mx-master --name \"$NAME\" --output out/mx-master\n// after\nNAME=\"${NAME:?device name required}\"\nopenlogi fixture contribute --id mx-master --name \"$NAME\" --output out/mx-master","handlingStrategy":"validation","validationCode":"[ -n \"${NAME//[[:space:]]/}\" ] || { echo \"--name required\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote and default-check name variables (${NAME:?msg}).","Validate name columns before batch fixture generation.","Trim user-supplied names and re-check emptiness after trimming."],"tags":["cli","validation","empty-value"],"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"}