swc-project/swc · error

{msg}

Error message

{msg}

What it means

The runner deserialized a PluginError from the bytes returned by the plugin and re-raises its embedded message verbatim as an anyhow error. The text comes from the plugin itself, so any plugin-side failure surfaces here with whatever detail the plugin chose to report.

Solutions

  1. Read the embedded message to identify the failing plugin and its cause
  2. Catch the error at the transform call site and continue without the plugin if it is optional
  3. Fix or update the plugin that produced the PluginError
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/swc_plugin_runner/src/transform_executor.rs:95 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17). Data as JSON: /api/errors/7333e39605dfc1b1. Report an issue: GitHub.

Appendix: source

Thrown at crates/swc_plugin_runner/src/transform_executor.rs:95

        // Arc<Mutex<T>>
        drop(self.instance);
        let transformed_result = Arc::try_unwrap(self.transform_result)
            .map_err(|_| {
                anyhow!("Failed to unwrap Arc: other references to transform_result exist")
            })?
            .into_inner();
        let ret = PluginSerializedBytes::from_bytes(transformed_result);

        let ret = if returned_ptr_result == 0 {
            Ok(ret)
        } else {
            let err: PluginError = ret.deserialize()?.into_inner();
            match err {
                PluginError::SizeInteropFailure(msg) => Err(anyhow!(
                    "Failed to convert pointer size to calculate: {msg}"
                )),
                PluginError::Deserialize(msg) | PluginError::Serialize(msg) => {
                    Err(anyhow!("{msg}"))
                }
                _ => Err(anyhow!(
                    "Unexpected error occurred while running plugin transform"
                )),
            }
        };

        ret
    }

    /**
     * Check compile-time version of AST schema between the plugin and
     * the host. Returns true if it's compatible, false otherwise.
     *
     * Host should appropriately handle if plugin is not compatible to the
     * current runtime.
     */
    #[allow(unreachable_code)]

View on GitHub (pinned to 5176682b65)