leptos-rs/leptos · error
keyword argument repeated: `client`
Error message
keyword argument repeated: `client`
What it means
This error occurs when the `client` keyword argument is repeated in a #[server] attribute. `client` overrides the client-side calling logic; a second value is ambiguous, so the macro's token-stream parser fails compilation with a span on the repeated key.
Source
Thrown at server_fn_macro/src/lib.rs:1149
}
input_derive = Some(stream.parse()?);
} else if key == "output" {
if encoding.is_some() {
return Err(syn::Error::new(
key.span(),
"`encoding` and `output` should not both be \
specified",
));
} else if output.is_some() {
return Err(syn::Error::new(
key.span(),
"keyword argument repeated: `output`",
));
}
output = Some(stream.parse()?);
} else if key == "server" {
if server.is_some() {
return Err(syn::Error::new(
key.span(),
"keyword argument repeated: `server`",
));
}
server = Some(stream.parse()?);
} else if key == "client" {
if client.is_some() {
return Err(syn::Error::new(
key.span(),
"keyword argument repeated: `client`",
));
}
client = Some(stream.parse()?);
} else if key == "custom" {
if custom_wrapper.is_some() {
return Err(syn::Error::new(
key.span(),
"keyword argument repeated: `custom`",View on GitHub (pinned to 32d20f6c9d)
Solutions
- Keep only one `client = ...` entry.
- Remove `client` entirely to use the default generated client.
- Fix macro wrappers to add `client` only when absent.
Example fix
// before
#[server(client = my_client::run, client = other::run)]
async fn save(data: String) -> Result<(), ServerFnError> { todo!() }
// after
#[server(client = my_client::run)]
async fn save(data: String) -> Result<(), ServerFnError> { todo!() } Defensive patterns
Strategy: validation
Validate before calling
// Pre-commit check for duplicate `client` args: // grep -rnE '#\[server\([^)\n]*client\s*=[^)\n]*client\s*=' src/ && exit 1 || exit 0
Prevention
- Specify `client = ...` at most once per attribute.
- Edit in place when changing the client override; do not append.
- Check macro wrapper layers for unconditional client injection.
- Catch duplicates with cargo check in a pre-commit or CI step.
When it happens
Trigger: Writing #[server(client = path1, client = path2)] in one attribute, or a macro wrapper injecting `client` when the user already provided one.
Common situations: Copy-paste of attribute args, refactoring the client override without deleting the old entry, generated macro layers that each add client.
Related errors
- keyword argument repeated: `encoding`
- keyword argument repeated: `endpoint`
- `encoding` and `input` should not both be specified
- keyword argument repeated: `input`
- `encoding` and `output` should not both be specified
AI-assisted analysis of leptos-rs/leptos@32d20f6c9d (2026-09-01).
Data as JSON: /api/errors/a2de8fd48ed020fe.
Report an issue: GitHub.