AprilNEA/OpenLogi · error

a sanitized profile route is not addressable

Error message

a sanitized profile route is not addressable

What it means

Raised in `capture_inventory` after `sanitize::inventory` rewrites the retained inventory: `DeviceRoute::device_route_for` returns `None` for a device in the sanitized profile. Sanitization replaces real identities with synthetic ones; if it leaves slot/pairing data inconsistent, route construction fails. This is a sanitizer invariant: sanitization must preserve addressability.

Solutions

  1. Run the sanitize module's tests (`cargo test -p openlogi-cli sanitize` or the fixture tests) to find which sanitizer rule breaks route addressability.
  2. Ensure `sanitize::inventory` preserves each retained device's slot or updates routes consistently after pruning.
  3. As a user, update the CLI to a version where the sanitizer is fixed; this is a code bug, not a configuration issue.

Example fix

// before: prune paired devices without re-slotting
retained.paired.retain(|d| wanted);
// after: keep slots consistent with retained receiver metadata
retained.paired.retain(|d| wanted);
// (and ensure device_route_for still resolves each retained device.slot)
Defensive patterns

Strategy: validation

Validate before calling

// after sanitize, assert routes still resolve
sanitize::inventory(&mut retained)?;
for d in &retained.paired {
    assert!(DeviceRoute::device_route_for(&retained, d.slot).is_some());
}

Prevention

When it happens

Trigger: `capture_inventory` calls `sanitize::inventory(&mut retained)` and then rebuilds routes; a sanitizer change (or bug) drops or corrupts slot/receiver metadata so `device_route_for` can no longer resolve a device.

Common situations: Recently modified sanitize rules in `record_profile/sanitize.rs` that renumber or prune paired devices without updating slots; a synthetic-identity policy change breaking route invariants.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of AprilNEA/OpenLogi@e846e6f4b4 (2026-09-13). Data as JSON: /api/errors/ed41a115e3f89bd9. Report an issue: GitHub.

Appendix: source

Thrown at crates/openlogi-cli/src/cmd/fixture/record_profile.rs:251

        .iter()
        .map(|device| {
            DeviceRoute::device_route_for(&retained, device.slot).ok_or_else(|| {
                anyhow!("a retained Agent inventory route is not safely addressable")
            })
        })
        .collect::<Result<Vec<_>>>()?;
    let retained_selected = if retained.receiver.unique_id.is_none() {
        0
    } else {
        selected_device
    };
    sanitize::inventory(&mut retained)?;
    let profile_routes = retained
        .paired
        .iter()
        .map(|device| {
            DeviceRoute::device_route_for(&retained, device.slot)
                .ok_or_else(|| anyhow!("a sanitized profile route is not addressable"))
        })
        .collect::<Result<Vec<_>>>()?;
    let selected_route = profile_routes
        .get(retained_selected)
        .cloned()
        .ok_or_else(|| anyhow!("the sanitized selected profile route is absent"))?;

    let mut settings = Vec::with_capacity(retained.paired.len());
    for ((source_route, profile_route), device) in source_routes
        .iter()
        .zip(profile_routes)
        .zip(&retained.paired)
    {
        settings.push(capture_hidpp_settings(client, source_route, profile_route, device).await?);
    }
    Ok((vec![retained], Vec::new(), settings, selected_route))
}

View on GitHub (pinned to e846e6f4b4)