diesel-rs/diesel · error · syn::Error

Invalid config

Error message

Invalid config

What it means

Compile-time error from DeclareSqlFunctionArgs::parse_from_macro_input. After successfully parsing a MetaNameValue for #[sql_function(...)], this guard fires when the key is not `generate_return_type_helpers` or the value is not a boolean literal — i.e. an unknown or mistyped option was passed to the sql_function macro. Fix: use `generate_return_type_helpers = true` or `= false`.

Solutions

  1. Pass no arguments for the default configuration
  2. Pass only `generate_return_type_helpers = true/false`
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at diesel_derives/src/sql_function.rs:2114 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diesel-rs/diesel@6fa6ed01b2 (2026-09-07). Data as JSON: /api/errors/da01f5e4835dc03d. Report an issue: GitHub.

Appendix: source

Thrown at diesel_derives/src/sql_function.rs:2114

            let span = e.span();
            syn::Error::new(
                span,
                format!("{e}, the correct format is `generate_return_type_helpers = true/false`"),
            )
        })?;
        match parsed {
            syn::MetaNameValue {
                path,
                value:
                    syn::Expr::Lit(syn::ExprLit {
                        lit: syn::Lit::Bool(b),
                        ..
                    }),
                ..
            } if path.is_ident("generate_return_type_helpers") => Ok(Self {
                generate_return_type_helpers: b.value,
            }),
            _ => Err(syn::Error::new(input_span, "Invalid config")),
        }
    }
}

View on GitHub (pinned to 6fa6ed01b2)