juspay/hyperswitch · error · syn::Error
This macro cannot be used on structs with no fields
Error message
This macro cannot be used on structs with no fields
What it means
Error "This macro cannot be used on structs with no fields" thrown in juspay/hyperswitch.
Source
Thrown at crates/router_derive/src/macros/helpers.rs:60
.into_iter()
.filter(|attr| attr.path().is_ident(ident))
.try_fold(Vec::new(), |mut vec, attr| {
vec.extend(attr.parse_args_with(Punctuated::<T, Token![,]>::parse_terminated)?);
Ok(vec)
})
}
pub(super) fn get_struct_fields(
data: syn::Data,
) -> syn::Result<Punctuated<syn::Field, syn::token::Comma>> {
if let syn::Data::Struct(syn::DataStruct {
fields: syn::Fields::Named(syn::FieldsNamed { ref named, .. }),
..
}) = data
{
Ok(named.to_owned())
} else {
Err(syn::Error::new(
Span::call_site(),
"This macro cannot be used on structs with no fields",
))
}
}
View on GitHub (pinned to 705a321950)
Solutions
- Add at least one field to the struct, or remove the derive macro from the empty struct
When it happens
Trigger: Thrown at crates/router_derive/src/macros/helpers.rs:60 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of juspay/hyperswitch@705a321950 (2026-08-19).
Data as JSON: /api/errors/7ce2c46b8b8c0680.
Report an issue: GitHub.