swc-project/swc · error

Failed to convert pointer size to calculate

Error message

Failed to convert pointer size to calculate: {msg}

What it means

The guest plugin returned PluginError::SizeInteropFailure: the buffer size it reported across the wasmtime ABI could not be converted to the host's pointer-size type, so the runner wraps the plugin's message and fails the transform. This indicates a plugin/host ABI or pointer-width mismatch.

Solutions

  1. Rebuild the plugin against a compatible swc_plugin/wasm ABI version
  2. Verify plugin and host agree on pointer width (32 vs 64-bit wasm)
  3. Remove or replace the misbehaving plugin
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/swc_plugin_runner/src/transform_executor.rs:91 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/409c249aecadcf1f. Report an issue: GitHub.

Appendix: source

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

        self.instance.cleanup()?;

        // Construct serialized struct from raw bytes.
        // Since we have finished transformation, it's safe to fetch the data from
        // 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.
     *

View on GitHub (pinned to 5176682b65)