AprilNEA/OpenLogi · error
fixture identity policy returned the wrong representation
Error message
fixture identity policy returned the wrong representation
What it means
Thrown by `profile_identity()` when `generate_synthetic_identity` returns a value that is not the profile-string representation expected for the requested kind. `as_profile_str()` yields None, meaning the fixture identity policy produced a variant the caller did not anticipate. This is an internal invariant check between openlogi-cli and the openlogi-fixture policy API.
Solutions
- Ensure the `kind` passed in is a string-backed identity kind; route byte-valued kinds (e.g. DeviceUnitId) through their dedicated accessors like `unit_id()`
- Update openlogi-fixture so every kind used by `profile_identity` implements `as_profile_str()`
- Re-sync openlogi-cli with the current openlogi-fixture API after a dependency upgrade
Defensive patterns
Strategy: type-guard
Validate before calling
if !matches!(kind, SyntheticIdentityKind::DisplayName | SyntheticIdentityKind::ProfileString) {
return Err(anyhow!("kind {} is not string-backed", kind as u8));
} Type guard
fn string_backed(v: &SyntheticIdentityValue) -> Option<String> {
v.as_profile_str().map(str::to_string)
} Try / catch
let id = generate_synthetic_identity(kind, ordinal);
if let Some(s) = id.as_profile_str() {
Ok(s.to_string())
} else {
Err(anyhow!("kind {:?} has no profile-string form", kind))
} Prevention
- Route each identity kind through its matching accessor (string kinds via profile_identity, byte kinds via unit_id)
- Add exhaustive match tests over SyntheticIdentityKind in openlogi-fixture
- Keep openlogi-cli and openlogi-fixture in the same workspace lockstep
When it happens
Trigger: Calling `generate_synthetic_identity(kind, ordinal)` and calling `.as_profile_str()` when the policy returns a non-string-backed variant for that kind — e.g. a kind like DeviceUnitId that maps to raw bytes instead of a display/profile string.
Common situations: A new SyntheticIdentityKind added to openlogi-fixture without a string profile representation; a refactor of the policy enum that changed which kinds are string-backed; mismatched crate versions where the CLI assumes old policy semantics.
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
- fixture structure verification failed: fixture paths must…
- capture failed with a host, open, disconnect, timeout…
- --name must not be empty
- --channel must not be empty
- refusing direct fixture capture because the agent endpoint…
AI-assisted analysis of AprilNEA/OpenLogi@e846e6f4b4 (2026-09-13).
Data as JSON: /api/errors/14d6f10978860103.
Report an issue: GitHub.
Appendix: source
Thrown at crates/openlogi-cli/src/cmd/fixture/record_profile/sanitize.rs:67
}
Ok(())
}
fn ordinal(index: usize) -> Result<SyntheticIdentityOrdinal> {
let value = u16::try_from(index.saturating_add(1))
.map_err(|_| anyhow!("captured profile has too many identities to sanitize"))?;
SyntheticIdentityOrdinal::new(value)
.map_err(|_| anyhow!("captured profile has too many identities to sanitize"))
}
fn profile_identity(
kind: SyntheticIdentityKind,
ordinal: SyntheticIdentityOrdinal,
) -> Result<String> {
generate_synthetic_identity(kind, ordinal)
.as_profile_str()
.map(str::to_string)
.ok_or_else(|| anyhow!("fixture identity policy returned the wrong representation"))
}
fn unit_id(ordinal: SyntheticIdentityOrdinal) -> Result<[u8; 4]> {
match generate_synthetic_identity(SyntheticIdentityKind::DeviceUnitId, ordinal) {
SyntheticIdentityValue::DeviceUnitId(value) => Ok(value),
_ => Err(anyhow!(
"fixture identity policy returned the wrong representation"
)),
}
}
View on GitHub (pinned to e846e6f4b4)