{"record":{"id":"b33769f137f96b23","repo":"AprilNEA/OpenLogi","slug":"selected-light-did-not-advertise-capabilities","errorCode":null,"errorMessage":"selected light did not advertise capabilities","messagePattern":"selected light did not advertise capabilities","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/light.rs","lineNumber":123,"sourceCode":"            }\n            println!(\"  power: {}\", if caps.power { \"yes\" } else { \"no\" });\n        }\n    }\n    Ok(())\n}\n\nasync fn set_power(query: Option<&str>, enabled: bool) -> Result<()> {\n    let devices = standalone().await?;\n    let device = select(&devices, query)?;\n    apply(device, LightCommand::Power(enabled)).await\n}\n\nasync fn set_brightness(args: BrightnessArgs) -> Result<()> {\n    let devices = standalone().await?;\n    let device = select(&devices, args.device.device.as_deref())?;\n    let caps = device\n        .light_capabilities\n        .ok_or_else(|| anyhow!(\"selected light did not advertise capabilities\"))?;\n    let range = caps\n        .brightness\n        .ok_or_else(|| anyhow!(\"selected light does not support brightness\"))?;\n    let command = match (args.percent, args.lumens) {\n        (Some(percent), None) => LightCommand::BrightnessPercent(percent),\n        (None, Some(lumens)) => {\n            if range.unit() != LightValueUnit::Lumens || !range.contains(lumens) {\n                return Err(anyhow!(\n                    \"lumens must be in the supported range {}..={} with step {}\",\n                    range.min(),\n                    range.max(),\n                    range.step()\n                ));\n            }\n            LightCommand::BrightnessNative(lumens)\n        }\n        (None, None) => return Err(anyhow!(\"pass either --percent or --lumens\")),\n        (Some(_), Some(_)) => unreachable!(\"clap enforces the argument conflict\"),","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/light.rs#L105-L141","documentation":"Raised in `set_brightness` when the selected device's snapshot has `light_capabilities: None`, meaning the device did not advertise any light (illumination) capabilities during probing. The CLI refuses to guess capabilities and requires the device to expose its light feature set before any brightness or temperature command.","triggerScenarios":"`openlogi light ... brightness` (or related light subcommands) targeting a device whose enumerated snapshot lacks light_capabilities — the device is not a light-capable product or the capability probe failed at enumeration.","commonSituations":"Pointing a light subcommand at a mouse or keyboard instead of a light-equipped product; the device was probed while asleep so capability blocks were never read; firmware/HID++ feature discovery failed for the attached unit.","solutions":["Verify the selected device actually supports lighting (check `openlogi list` output for light capabilities)","Power-cycle or wake the device and re-enumerate so capabilities are probed again","Re-pair or reconnect the device if capability probing consistently returns nothing","Use the correct subcommand family for the device type you actually attached"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"let device = select(&devices, name)?;\nif device.light_capabilities.is_none() {\n    anyhow::bail!(\"{} exposes no light capabilities\", device.display_name);\n}","typeGuard":"fn light_caps(d: &Device) -> Option<&LightCapabilities> {\n    d.light_capabilities.as_ref()\n}","tryCatchPattern":"match set_brightness(args).await {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"did not advertise capabilities\") => {\n        eprintln!(\"This device has no lighting features; check `openlogi list`.\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check light_capabilities in `openlogi list` output before issuing light commands","Wake/re-plug devices that enumerate with empty capability blocks","Refresh the probe cache if capabilities look stale after device swaps"],"tags":["cli","hardware","capabilities","lighting"],"backgroundTag":"unsupported-operation","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"}