{"record":{"id":"c290daad9627182d","repo":"tauri-apps/tauri","slug":"unexpected-value-for-capabilities","errorCode":null,"errorMessage":"unexpected value for capabilities","messagePattern":"unexpected value for capabilities","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-macros/src/context.rs","lineNumber":89,"sourceCode":"                    .into_iter()\n                    .map(|e| {\n                      if let Expr::Lit(ExprLit {\n                        attrs: _,\n                        lit: Lit::Str(s),\n                      }) = e\n                      {\n                        Ok(s.value().into())\n                      } else {\n                        Err(syn::Error::new(\n                          input.span(),\n                          \"unexpected expression for capability\",\n                        ))\n                      }\n                    })\n                    .collect::<Result<Vec<_>, syn::Error>>()?,\n                );\n              } else {\n                return Err(syn::Error::new(\n                  input.span(),\n                  \"unexpected value for capabilities\",\n                ));\n              }\n            }\n            \"assets\" => {\n              assets.replace(v.value);\n            }\n            \"test\" => {\n              if let Expr::Lit(ExprLit {\n                lit: Lit::Bool(LitBool { value, .. }),\n                ..\n              }) = v.value\n              {\n                test = value;\n              } else {\n                return Err(syn::Error::new(input.span(), \"unexpected value for test\"));\n              }","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-macros/src/context.rs#L71-L107","documentation":"A compile-time error from `tauri::generate_context!`. The `capabilities` attribute must be a name-value pair whose value is an array of string literals. Any other value shape (a single string, a parenthesized expression, a path, etc.) is rejected by the macro parser.","triggerScenarios":"Writing `capabilities = \"main\"` (missing brackets) or `capabilities = foo()` inside a `generate_context!` invocation.","commonSituations":"Copy-pasting capability config from documentation that used a different syntax; forgetting the `[...]` array when only one capability file is listed.","solutions":["Wrap the value in an array of string literals: capabilities = [\"capabilities/default\"]","Check the generate_context! attribute syntax in the Tauri docs","If the intent is to declare capabilities, put them in the tauri.conf.json `app.security.capabilities` field instead"],"exampleFix":"// before\ntauri::generate_context!(\"tauri.conf.json\", capabilities = \"default\")\n// after\ntauri::generate_context!(\"tauri.conf.json\", capabilities = [\"default\"])","handlingStrategy":"validation","validationCode":"// capabilities value must be an array of strings\nfn valid_capabilities(v: &str) -> bool {\n  let t = v.trim();\n  t.starts_with('[') && t.ends_with(']') && t.contains('\"')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use array syntax even for a single capability: capabilities = [\"...\"]","Prefer declaring capabilities in tauri.conf.json instead of the macro","Check docs for the exact macro syntax of your Tauri version"],"tags":["compile-time","macro","capabilities","syntax"],"backgroundTag":"invalid-argument-format","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}