DioxusLabs/dioxus · error

Unsupported type

Error message

Unsupported type

What it means

`ForeignType::from_type` is the fallback error for any type expression in an FFI signature that matches none of the handled shapes (paths, references, etc.) — e.g. tuples, arrays, or fn pointers. The offending type in a Swift/Kotlin extern block is rejected at compile time.

Solutions

  1. Change the parameter or return type to one of the types supported by the FFI macro (primitives, String, Option, Result, or declared FFI types).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/manganis/manganis-macro/src/ffi.rs:122 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/eab407a5598ea0fc. Report an issue: GitHub.

Appendix: source

Thrown at packages/manganis/manganis-macro/src/ffi.rs:122

                        }
                    }
                }
                Err(syn::Error::new(ty.span(), "Unsupported type path"))
            }
            Type::Reference(type_ref) => {
                if let Type::Path(path) = &*type_ref.elem {
                    if path.path.is_ident("str") {
                        return Ok(ForeignType::StrRef);
                    }
                    // Check for &OpaqueType
                    if path.path.segments.len() == 1 {
                        return Ok(ForeignType::OpaqueRef(path.path.segments[0].ident.clone()));
                    }
                }
                Err(syn::Error::new(ty.span(), "Unsupported reference type"))
            }
            Type::Tuple(tuple) if tuple.elems.is_empty() => Ok(ForeignType::Unit),
            _ => Err(syn::Error::new(ty.span(), "Unsupported type")),
        }
    }

    /// Get the JNI signature for this type
    fn jni_signature(&self) -> String {
        match self {
            ForeignType::Bool => "Z".into(),
            ForeignType::I8 => "B".into(),
            ForeignType::I16 => "S".into(),
            ForeignType::I32 => "I".into(),
            ForeignType::I64 => "J".into(),
            ForeignType::U8 => "B".into(), // JNI doesn't have unsigned, use signed
            ForeignType::U16 => "S".into(),
            ForeignType::U32 => "I".into(),
            ForeignType::U64 => "J".into(),
            ForeignType::F32 => "F".into(),
            ForeignType::F64 => "D".into(),
            ForeignType::String | ForeignType::StrRef => "Ljava/lang/String;".into(),

View on GitHub (pinned to 24f6a829df)