{"record":{"id":"0a50be97530b7615","repo":"diesel-rs/diesel","slug":"expected-valid-identifier-found-0-diesel-aut","errorCode":null,"errorMessage":"expected valid identifier, found `{0}`. Diesel automatically renames invalid identifiers, perhaps you meant to write `{0}_`?","messagePattern":"expected valid identifier, found `(.+?)`\\. Diesel automatically renames invalid identifiers, perhaps you meant to write `(.+?)_`\\?","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"diesel_attribute_parser/src/lib.rs","lineNumber":107,"sourceCode":"    pub fn span(&self) -> Span {\n        self.span\n    }\n\n    pub fn to_ident(&self) -> Result<Ident> {\n        match syn::parse_str::<Ident>(&format!(\"r#{}\", self.field_name)) {\n            Ok(mut ident) => {\n                ident.set_span(self.span);\n                Ok(ident)\n            }\n            Err(_e) if self.field_name.contains(' ') => Err(syn::Error::new(\n                self.span(),\n                format!(\n                    \"expected valid identifier, found `{0}`. \\\n                 Diesel does not support column names with whitespaces yet\",\n                    self.field_name\n                ),\n            )),\n            Err(_e) => Err(syn::Error::new(\n                self.span(),\n                format!(\n                    \"expected valid identifier, found `{0}`. \\\n                 Diesel automatically renames invalid identifiers, \\\n                 perhaps you meant to write `{0}_`?\",\n                    self.field_name\n                ),\n            )),\n        }\n    }\n}\n\nimpl ToTokens for SqlIdentifier {\n    fn to_tokens(&self, tokens: &mut TokenStream) {\n        if self.field_name.starts_with(\"r#\") {\n            Ident::new_raw(&self.field_name[2..], self.span).to_tokens(tokens)\n        } else {\n            Ident::new(&self.field_name, self.span).to_tokens(tokens)","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_attribute_parser/src/lib.rs#L89-L125","documentation":"A field name containing whitespace cannot be turned into a Rust identifier. The offending input is the field name with spaces; Diesel can rename other invalid identifiers, but whitespace is not supported.","triggerScenarios":"Thrown at diesel_attribute_parser/src/lib.rs:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the column so it contains no whitespace","Map the field explicitly to a valid Rust identifier","Remove spaces or use a different database column name"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}