{"record":{"id":"ca6c57de60cf89af","repo":"diesel-rs/diesel","slug":"must-be-in-the-form-something","errorCode":null,"errorMessage":"`{}` must be in the form `#[{}=\"something\"]`","messagePattern":"`(.+?)` must be in the form `#\\[(.+?)=\"something\"\\]`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"diesel_migrations/migrations_macros/src/util.rs","lineNumber":9,"sourceCode":"use syn::*;\n\npub fn str_value_of_meta_item(item: &Meta, name: &str) -> String {\n    match *item {\n        Meta::NameValue(MetaNameValue {\n            lit: Lit::Str(ref value),\n            ..\n        }) => value.value(),\n        _ => panic!(\n            r#\"`{}` must be in the form `#[{}=\"something\"]`\"#,\n            name, name\n        ),\n    }\n}\n\npub fn get_options_from_input(\n    name: &Path,\n    attrs: &[Attribute],\n    on_bug: fn() -> !,\n) -> Option<Vec<Meta>> {\n    let options = attrs\n        .iter()\n        .find(|a| &a.path == name)\n        .map(Attribute::parse_meta);\n    match options {\n        Some(Ok(Meta::List(MetaList { ref nested, .. }))) => Some(\n            nested","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/diesel_migrations/migrations_macros/src/util.rs#L1-L27","documentation":"Helper `str_value_of_meta_item` in diesel's migrations macros expects an attribute in the exact string-literal form `#[name = \"something\"]`. If the attribute exists but is not a `Meta::NameValue` with a `Lit::Str` (e.g. a path/flag-style attribute or a non-string literal), the macro panics with this message naming the expected attribute.","triggerScenarios":"Writing `#[migration_name = something]` (non-string literal), `#[migration_name]` (flag without value), or `#[migration_name = 42]` on a module used with `embed_migrations!` / `import_migrations!` style attributes (e.g. `migration_name`, `migration_version`).","commonSituations":"Copy-pasting attribute syntax from other crates; forgetting quotes around the value; using `=` with an identifier instead of a string literal; typos creating duplicate attributes.","solutions":["Quote the attribute value: `#[migration_name = \"my_migration\"]`.","Ensure the attribute is a key = \"string literal\" pair, not a bare flag or path segment.","Remove non-string literals (numbers, bools) and wrap them in string form if the option accepts them.","Check the diesel version's documented attribute names for the macro you use."],"exampleFix":"// before\n#[migration_name = create_users]\nmod migrations;\n// after\n#[migration_name = \"create_users\"]\nmod migrations;","handlingStrategy":"validation","validationCode":"// attribute values must be string literals\n// bad: #[migration_name = foo] or #[migration_name]\n// good:\n#[migration_name = \"create_users\"]\nmod migrations {}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write macro attributes as `#[name = \"string literal\"]`.","Copy attribute syntax from diesel docs/tests, not other crates.","Let rustfmt/rust-analyzer surface macro attribute syntax errors early."],"tags":["compile-time","proc-macro","attributes","syntax"],"backgroundTag":"invalid-argument-format","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"}