diesel-rs/diesel · error
unexpected end of input, expected parentheses help: the…
Error message
unexpected end of input, expected parentheses
help: the correct format looks like `#[diesel({POSTGRES_TYPE_NOTE})]` What it means
The Postgres type attribute parser ran out of tokens before it could read the parenthesized argument list. The offending input is the macro body, which ended before the required `(...)` could be parsed.
Solutions
- Add the required parentheses around the attribute arguments
- Follow the documented `#[diesel(postgres_type(...))]` form
- Check that the attribute was not truncated
Example fix
// before #[diesel(postgres_type)] pub struct MyType; // after #[diesel(postgres_type(name = "my_type"))] pub struct MyType;
Defensive patterns
Strategy: validation
Validate before calling
// compile-time: #[diesel(postgres_type(name = "my_type"))]
Prevention
- Always include parentheses and arguments on postgres_type
- Follow current diesel custom-type docs
When it happens
Trigger: Writing `#[diesel(postgres_type)]` without `(name = "...")` or similar arguments on a type in a `#[derive(SqlType)]` context.
Common situations: Defining custom PostgreSQL types and omitting the type name mapping, or following outdated examples.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- unexpected end of input, expected parentheses help: the…
- expected `foreign_key`
- unexpected end of input, expected parentheses
- expected `treat_none_as_null`
- unexpected end of input, expected parentheses
AI-assisted analysis of diesel-rs/diesel@6fa6ed01b2 (2026-09-07).
Data as JSON: /api/errors/7bcba8b340533f5b.
Report an issue: GitHub.
Appendix: source
Thrown at diesel_attribute_parser/src/deprecated/postgres_type.rs:43
lit_str.parse()?
})),
"array_oid" => Ok(Attr::ArrayOid(name.clone(), {
let lit_str = parse_eq_and_lit_str(name, input, POSTGRES_TYPE_NOTE)?;
lit_str.parse()?
})),
"type_name" => Ok(Attr::TypeName(
name.clone(),
parse_eq_and_lit_str(name, input, POSTGRES_TYPE_NOTE)?,
)),
_ => Err(unknown_attribute(&name, &["oid", "array_oid", "type_name"])),
}
}
}
pub fn parse_postgres_type(name: Ident, input: ParseStream) -> Result<PostgresType> {
if input.is_empty() {
return Err(syn::Error::new(
name.span(),
format!(
"unexpected end of input, expected parentheses\n\
help: the correct format looks like `#[diesel({POSTGRES_TYPE_NOTE})]`"
),
));
}
let content;
parenthesized!(content in input);
let mut oid = None;
let mut array_oid = None;
let mut type_name = None;
for attr in Punctuated::<Attr, Comma>::parse_terminated(&content)? {
match attr {
Attr::Oid(ident, value) => oid = Some((ident, value)),View on GitHub (pinned to 6fa6ed01b2)