juspay/hyperswitch · error · syn::Error
error(error_type_enum) attribute not found
Error message
error(error_type_enum) attribute not found
What it means
Error "error(error_type_enum) attribute not found" thrown in juspay/hyperswitch.
Source
Thrown at crates/router_derive/src/macros/api_error/helpers.rs:90
fn get_type_properties(&self) -> syn::Result<ErrorTypeProperties> {
let mut output = ErrorTypeProperties::default();
let mut error_type_enum_keyword = None;
for meta in self.get_metadata()? {
match meta {
EnumMeta::ErrorTypeEnum { keyword, value } => {
if let Some(first_keyword) = error_type_enum_keyword {
return Err(occurrence_error(first_keyword, keyword, "error_type_enum"));
}
error_type_enum_keyword = Some(keyword);
output.error_type_enum = Some(value);
}
}
}
if output.error_type_enum.is_none() {
return Err(syn::Error::new(
self.span(),
"error(error_type_enum) attribute not found",
));
}
Ok(output)
}
}
enum VariantMeta {
ErrorType {
keyword: keyword::error_type,
value: TypePath,
},
Code {
keyword: keyword::code,
value: LitStr,
},View on GitHub (pinned to 705a321950)
Solutions
- Add the #[error(error_type = ...)] attribute to the error enum variant as required by the api_error derive macro
When it happens
Trigger: Thrown at crates/router_derive/src/macros/api_error/helpers.rs:90 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/f1cb7996165a80b8.
Report an issue: GitHub.