{"record":{"id":"e145754af435e78f","repo":"diesel-rs/diesel","slug":"expected-attribute-name-help-the-correct-format-e14575","errorCode":null,"errorMessage":"expected attribute `name`\nhelp: the correct format looks like #[diesel({SQLITE_TYPE_NOTE})]","messagePattern":"expected attribute `name`\nhelp: the correct format looks like #\\[diesel\\((.+?)\\)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"diesel_attribute_parser/src/parsers/sqlite_type.rs","lineNumber":43,"sourceCode":"\npub struct SqliteType {\n    pub name: LitStr,\n}\n\nimpl Parse for SqliteType {\n    fn parse(input: ParseStream) -> Result<Self> {\n        let mut name = None;\n\n        for attr in Punctuated::<Attr, Comma>::parse_terminated(input)? {\n            match attr {\n                Attr::Name(value) => name = Some(value),\n            }\n        }\n\n        if let Some(name) = name {\n            Ok(SqliteType { name })\n        } else {\n            Err(syn::Error::new(\n                input.span(),\n                format!(\n                    \"expected attribute `name`\\n\\\n                     help: the correct format looks like #[diesel({SQLITE_TYPE_NOTE})]\"\n                ),\n            ))\n        }\n    }\n}\n","sourceCodeStart":25,"sourceCodeEnd":53,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_attribute_parser/src/parsers/sqlite_type.rs#L25-L53","documentation":"This error comes from diesel's `#[diesel(sqlite_type(...))]` attribute parser. The attribute requires a `name` key specifying the SQLite type name, and the parser raises this error when the attribute content is empty or contains keys but no `name`. It includes a help line showing the expected format.","triggerScenarios":"Writing `#[diesel()]` or `#[diesel(sqlite_type)]`/`#[diesel(sqlite_type())]` without a `name = ...` entry inside parentheses when the sqlite_type parser runs on the attribute.","commonSituations":"Hand-writing a `SqliteType` registration or copying an example attribute and forgetting the `name = \"...\"` key; typos like `nam =` also drop into this path if unknown keys are skipped.","solutions":["Add the required `name` key: `#[diesel(sqlite_type(name = \"...\"))]`","Check spelling of the key (must be exactly `name`)","Consult the SQLITE_TYPE_NOTE help text in the diesel docs for the correct format"],"exampleFix":"// before\n#[diesel(sqlite_type())]\nstruct MyType;\n// after\n#[diesel(sqlite_type(name = \"integer\"))]\nstruct MyType;","handlingStrategy":"validation","validationCode":"// Check attribute content before expanding\nlet attr_src = quote::quote! { #attr }.to_string();\nassert!(attr_src.contains(\"name\"), \"#[diesel(sqlite_type(...))] requires `name = ...`\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include `name = \"...\"` inside `#[diesel(sqlite_type(...))]`","Copy the exact example from diesel docs rather than writing from memory","Let rust-analyzer completions fill attribute keys"],"tags":["rust","proc-macro","diesel","attribute-parsing"],"backgroundTag":"missing-required-argument","analyzedSha":"6fa6ed01b24b24248ab2a611698d0a7c6a2e9120","analyzedAt":"2026-09-07T01:50:13.074Z","contentChangedAt":"2026-09-07T01:50:13.074Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}