spacedriveapp/spacedrive · warning · anyhow::Error
Invalid sidecar format: {}
Error message
Invalid sidecar format: {} What it means
Converting the sidecar row's format string into SidecarFormat via TryInto failed while building sidecar availability; the passthrough error names the invalid value. The database contains a format identifier this build does not recognize, and one bad row aborts the whole availability listing for that content.
Source
Thrown at core/src/service/sidecar_manager.rs:163
// Build presence map
let mut presence_map: HashMap<Uuid, HashMap<String, SidecarPresence>> = HashMap::new();
for sidecar in sidecars {
let entry = presence_map
.entry(sidecar.content_uuid)
.or_insert_with(HashMap::new);
let path = self
.compute_path(
&library.id(),
&sidecar.content_uuid,
&kind,
&SidecarVariant::new(&sidecar.variant),
&sidecar
.format
.as_str()
.try_into()
.map_err(|e: String| anyhow::anyhow!(e))?,
)
.await?;
entry.insert(
sidecar.variant.clone(),
SidecarPresence {
local: true,
path: Some(path.relative_path),
status: sidecar
.status
.as_str()
.try_into()
.map_err(|e: String| anyhow::anyhow!(e))?,
devices: vec![],
},
);
}
View on GitHub (pinned to 6dfeccf211)
Solutions
- Query the sidecar table for the affected content and inspect its format values; normalize or delete unknown ones
- Skip rows with unknown formats (warn and continue) instead of failing the entire availability listing
- On upgrade, run a data migration that maps or prunes retired format identifiers
Example fix
// before
let format = sidecar.format.as_str().try_into().map_err(|e: String| anyhow::anyhow!(e))?;
// after
let Ok(format) = SidecarFormat::try_from(sidecar.format.as_str()) else {
warn!(format = %sidecar.format, "unknown sidecar format, skipping row");
continue;
}; Defensive patterns
Strategy: fallback
Validate before calling
// Filter unknown formats out before they abort the listing let known: Vec<&SidecarRow> = rows.iter().filter(|r| SidecarFormat::try_from(r.format.as_str()).is_ok()).collect();
Type guard
fn is_known_sidecar_format(value: &str) -> bool {
SidecarFormat::try_from(value).is_ok()
} Try / catch
match SidecarFormat::try_from(sidecar.format.as_str()) {
Ok(format) => { /* use it */ }
Err(_) => {
warn!(format = %sidecar.format, "unknown sidecar format, skipping row");
continue;
}
} Prevention
- Migrate or prune retired format identifiers on upgrade
- Skip-and-warn on unknown enum values from the database instead of failing the batch
- Add a database constraint or write path that only persists known formats
When it happens
Trigger: A sidecar row written by a newer version with formats this version does not know; manually edited or imported databases; a format variant renamed or removed between versions.
Common situations: Downgrading an install; experimental formats enabled earlier and later removed; a sync peer on a newer version writing formats the local build cannot parse.
Related errors
- Invalid sidecar status: {}
- Invalid event type: {}
- Invalid category: {}
- Invalid severity: {}
- Failed to initialize core: error code ${result}
AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16).
Data as JSON: /api/errors/a1ad1322ee028556.
Report an issue: GitHub.