DioxusLabs/dioxus · error
doc attribute is not a string literal
Error message
doc attribute is not a string literal
What it means
In doc_iter, a #[doc] name-value attribute's expression was not a string literal (Expr::Lit with LitStr). Doc attributes must be string literals; any other expression form reaches this panic in the fullstack macro.
Source
Thrown at packages/fullstack-macro/src/lib.rs:1321
.map(|item| (parse_quote!(summary), item.clone()))
}
if self.id.is_none() {
let id = &function.sig.ident;
self.id = Some((parse_quote!(id), LitStr::new(&id.to_string(), id.span())));
}
}
}
fn doc_iter(attrs: &[Attribute]) -> impl Iterator<Item = &LitStr> + '_ {
attrs
.iter()
.filter(|attr| attr.path().is_ident("doc"))
.map(|attr| {
let Meta::NameValue(meta) = &attr.meta else {
panic!("doc attribute is not a name-value attribute");
};
let Expr::Lit(lit) = &meta.value else {
panic!("doc attribute is not a string literal");
};
let Lit::Str(lit_str) = &lit.lit else {
panic!("doc attribute is not a string literal");
};
lit_str
})
}
struct Route {
method: Option<Method>,
path_params: Vec<(Slash, PathParam)>,
query_params: Vec<QueryParam>,
route_lit: Option<LitStr>,
prefix: Option<LitStr>,
oapi_options: Option<OapiOptions>,
server_args: Punctuated<FnArg, Comma>,
// todo: support these since `server_fn` had themView on GitHub (pinned to 24f6a829df)
Solutions
- The doc attribute value must be a string literal: #[doc = 'text'].
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/fullstack-macro/src/lib.rs:1321 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/1942d700f67c2e19.
Report an issue: GitHub.