{"record":{"id":"c7e8e6fcbfec6747","repo":"AprilNEA/OpenLogi","slug":"a-retained-agent-inventory-route-is-not-safely-addressable","errorCode":null,"errorMessage":"a retained Agent inventory route is not safely addressable","messagePattern":"a retained Agent inventory route is not safely addressable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/fixture/record_profile.rs","lineNumber":236,"sourceCode":"\nasync fn capture_inventory(\n    client: &AgentClient,\n    source: &DeviceInventory,\n    selected_device: usize,\n) -> Result<ProfileCaptureParts> {\n    let mut retained = source.clone();\n    if retained.receiver.unique_id.is_none() {\n        retained.paired = vec![source.paired.get(selected_device).cloned().ok_or_else(|| {\n            anyhow!(\"the selected direct device is absent from the Agent snapshot\")\n        })?];\n    }\n\n    let source_routes = retained\n        .paired\n        .iter()\n        .map(|device| {\n            DeviceRoute::device_route_for(&retained, device.slot).ok_or_else(|| {\n                anyhow!(\"a retained Agent inventory route is not safely addressable\")\n            })\n        })\n        .collect::<Result<Vec<_>>>()?;\n    let retained_selected = if retained.receiver.unique_id.is_none() {\n        0\n    } else {\n        selected_device\n    };\n    sanitize::inventory(&mut retained)?;\n    let profile_routes = retained\n        .paired\n        .iter()\n        .map(|device| {\n            DeviceRoute::device_route_for(&retained, device.slot)\n                .ok_or_else(|| anyhow!(\"a sanitized profile route is not addressable\"))\n        })\n        .collect::<Result<Vec<_>>>()?;\n    let selected_route = profile_routes","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/fixture/record_profile.rs#L218-L254","documentation":"Raised in `capture_inventory` when `DeviceRoute::device_route_for(&retained, device.slot)` returns `None` for any device in the retained (pre-sanitization) inventory's `paired` list. Every retained device must be safely addressable on the HID++ route so its settings can be read; an unaddressable route means the inventory data is internally inconsistent (e.g. slot has no resolving route in the receiver/standalone structure).","triggerScenarios":"`capture_inventory` iterates `retained.paired` and builds routes; `device_route_for` fails for a device whose slot cannot be mapped to a route — typically a slot value inconsistent with the inventory's receiver/pairing metadata in the Agent snapshot.","commonSituations":"An agent snapshot with corrupt or transitional pairing state (device mid-pairing); a device record whose slot references a nonexistent receiver container; snapshot produced by an agent version with different route semantics.","solutions":["Restart the agent to refresh its device inventory and retry the capture.","Confirm all devices finish pairing before recording (no devices mid-enumeration).","Check agent/CLI protocol version match (the CLI already bails on mismatch earlier, but an older running agent binary can emit odd slot data).","If reproducible with a specific device, capture `openlogi list` output and file a bug with the inventory shape."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-check every paired device resolves a route before capture\nfor d in &inventory.paired {\n    assert!(DeviceRoute::device_route_for(&inventory, d.slot).is_some(), \"unaddressable slot {}\", d.slot);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restart the agent if inventory slot data looks inconsistent.","Avoid recording profiles while devices are mid-pairing.","Keep agent and CLI on the same release so route semantics match."],"tags":["rust","cli","hidpp","device-route"],"backgroundTag":"internal-invariant-violation","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"}