perspective-dev/perspective · error
Invalid plugin config
Error message
Invalid plugin config
What it means
The wasm_bindgen TryFromJsValue-style conversion for a viewer plugin's config object fails when the JS value passed (e.g. to restore() or a plugin setter) does not match the expected plugin config shape — wrong type, missing fields, or a non-object. The generic message reports the failed deserialization into the Rust config struct.
Solutions
- Inspect the JS value being converted; ensure it matches the plugin's expected config schema
- Use the plugin's own save()/restore() round-trip to produce valid config objects
- Validate the config JSON before passing it across the JS/WASM boundary
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at rust/perspective-viewer/src/rust/js/plugin.rs:213 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of perspective-dev/perspective@11c8238c0c (2026-09-09).
Data as JSON: /api/errors/9585c98be9b22922.
Report an issue: GitHub.
Appendix: source
Thrown at rust/perspective-viewer/src/rust/js/plugin.rs:213
force: bool
) -> ApiResult<()>;
#[wasm_bindgen(method, catch, js_name = clear)]
async fn _clear(this: &JsPerspectiveViewerPlugin) -> ApiResult<JsValue>;
#[wasm_bindgen(method, catch, js_name = resize)]
async fn _resize(this: &JsPerspectiveViewerPlugin) -> ApiResult<JsValue>;
#[wasm_bindgen(method, catch, js_name = deselect)]
async fn _deselect(this: &JsPerspectiveViewerPlugin) -> ApiResult<()>;
#[wasm_bindgen(method, catch, js_name = presize)]
async fn _presize(this: &JsPerspectiveViewerPlugin, width: f64, height: f64) -> ApiResult<JsValue>;
}
impl From<JsPluginStaticConfig> for PluginStaticConfig {
fn from(value: JsPluginStaticConfig) -> Self {
value.into_serde_ext().expect("Invalid plugin config")
}
}
/// Which OPTIONAL plugin methods a plugin implements (see "Capability
/// tiers" on [`JsPerspectiveViewerPlugin`]). Detected once per
/// custom-element tag — methods live on the class prototype, so every
/// instance of a tag answers identically — and memoized; call sites read
/// cached flags instead of running per-call `Reflect` probes.
#[derive(Clone, Copy, Debug, Default)]
pub struct PluginCapabilities {
pub draw: bool,
pub update: bool,
pub resize: bool,
pub restyle: bool,
pub clear: bool,
pub deselect: bool,
pub presize: bool,
pub render: bool,View on GitHub (pinned to 11c8238c0c)