dmtrKovalenko/fff · info
Failed to serialize health check
Error message
Failed to serialize health check: {} What it means
fff_health_check builds a health JSON object and serializes it with serde_json::to_string; if serialization fails, this error is returned. This is rare because the input is a constructed serde_json::Value, but it guards the FFI boundary against any serialization failure.
Solutions
- Retry the call — transient allocation failures may resolve.
- Check process memory availability if running in constrained environments.
- Verify you are using a compatible serde_json version if linking statically.
- Report to maintainers if reproducible — serializing a built Value should not fail.
Example fix
null
Defensive patterns
Strategy: try-catch
Try / catch
local res = fff.health_check(inst)
if res.is_err then health_json = '{}' end Prevention
- Ensure adequate process memory in constrained environments.
- Retry once on transient serialization failures.
- Report reproducible failures upstream — this should never fire.
When it happens
Trigger: Calling fff_health_check when serde_json cannot serialize the assembled health map — practically only due to a serde_json internal failure such as an exhausted allocator or a non-string map key that slipped into the construction.
Common situations: Extremely low-memory environments; custom/patched serde_json builds with strict settings; latent library bug putting invalid data into the health object.
Understand the failure class
Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.
Related errors
- fff native library not found. Run `npx @ff-labs/fff-node…
- fff native library not found. Run `npx @ff-labs/fff-node…
- Failed to create FFF file picker for
- Instance handle is null. Create one with…
- opts is null
AI-assisted analysis of dmtrKovalenko/fff@7f8537e70f (2026-09-10).
Data as JSON: /api/errors/146e729518f9396f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/fff-c/src/lib.rs:1338
serde_json::Value::Object(db_health),
);
}
}
Err(_) => {
query_info.insert("initialized".to_string(), serde_json::Value::Bool(false));
}
}
} else {
query_info.insert("initialized".to_string(), serde_json::Value::Bool(false));
}
health.insert(
"query_tracker".to_string(),
serde_json::Value::Object(query_info),
);
match serde_json::to_string(&health) {
Ok(json) => FffResult::ok_string(&json),
Err(e) => FffResult::err(&format!("Failed to serialize health check: {}", e)),
}
}
/// Free a search result returned by `fff_search`: the struct, its `items`
/// and `scores` arrays, and every string within.
///
/// ## Safety
/// `result` must be a valid pointer previously returned via `FffResult.handle`
/// from `fff_search`, or null (no-op).
#[unsafe(no_mangle)]
pub unsafe extern "C" fn fff_free_search_result(result: *mut FffSearchResult) {
if result.is_null() {
return;
}
unsafe {
let result = Box::from_raw(result);
let count = result.count as usize;View on GitHub (pinned to 7f8537e70f)