{"record":{"id":"c0a765fc03e64b0d","repo":"tauri-apps/tauri","slug":"could-not-find-a-capability-to-update","errorCode":null,"errorMessage":"Could not find a capability to update","messagePattern":"Could not find a capability to update","errorType":"exception","errorClass":"Error::GenericError","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/acl/permission/add.rs","lineNumber":262,"sourceCode":"        .collect::<Vec<_>>()\n        .as_slice(),\n      None,\n    )?;\n\n    if selections.is_empty() {\n      crate::error::bail!(\"You did not select any capabilities to update\");\n    }\n\n    selections\n      .into_iter()\n      .map(|idx| capabilities[idx].clone())\n      .collect()\n  } else {\n    capabilities\n  };\n\n  if capabilities.is_empty() {\n    crate::error::bail!(\"Could not find a capability to update\");\n  }\n\n  for (capability, path) in &mut capabilities {\n    if capability.has_permission(&options.identifier) {\n      log::info!(\n        \"Permission `{}` already found in `{}` at {}\",\n        options.identifier,\n        capability.identifier(),\n        dunce::simplified(path).display()\n      );\n    } else {\n      capability.insert_permission(options.identifier.clone());\n      std::fs::write(&*path, capability.to_string()?)\n        .fs_context(\"failed to write capability file\", path.clone())?;\n      log::info!(action = \"Added\"; \"permission `{}` to `{}` at {}\", options.identifier, capability.identifier(), dunce::simplified(path).display());\n    }\n  }\n","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/acl/permission/add.rs#L244-L280","documentation":"After `tauri permission add` collects candidate capabilities, the filtered list is empty. Filtering happens in `filter_map`: files whose extension/content cannot be parsed into a capability are silently dropped, and when `--capability <id>` is passed, only capabilities whose `identifier` field equals that value survive. (Note: for known desktop-only/mobile-only plugins an auto-created capability rescues the empty case, so this error comes from the identifier-filter or unparseable-file path.)","triggerScenarios":"Passing `--capability my-app` when no `capabilities/*.json|toml` file has `\"identifier\": \"my-app\"`; or every file in `capabilities/` being invalid (wrong extension, malformed JSON/TOML, missing `identifier`), causing all entries to be dropped by `capability_from_path`.","commonSituations":"Typos in the capability id; renaming a capability file without updating its `identifier` field; hand-edited capability files with syntax errors; capability files named `.yaml` or with no identifier.","solutions":["List the actual identifiers your project declares: `grep -h '\"identifier\"' src-tauri/capabilities/*` and pass one of those to `--capability`","Validate every file in `capabilities/` parses as JSON or TOML and contains a non-empty `identifier` field","If no capability exists yet, create one (e.g. `tauri capability add` or add `src-tauri/capabilities/default.json` with an `identifier`)"],"exampleFix":"// before (src-tauri/capabilities/main.json)\n{ \"identifier\": \"main-cap\", \"windows\": [\"main\"] }\n// run: tauri permission add fs:default --capability main   <-- no match\n\n// after\ntauri permission add fs:default --capability main-cap","handlingStrategy":"validation","validationCode":"# fail fast if the requested capability identifier does not exist\nCAP=\"$1\"\nif ! grep -q \"\\\"identifier\\\"[^A-Za-z0-9_-]*[\\\"']${CAP}[\\\"']\" src-tauri/capabilities/*; then\n  echo \"capability '$CAP' not declared\" >&2; exit 1\nfi\ntauri permission add my-plugin:default --capability \"$CAP\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give every capability file an explicit non-empty `identifier` and reference that exact string","Validate capability JSON/TOML after hand edits (one wrong file silently drops out of the candidate list)","In automation, check `grep '\"identifier\"' capabilities/*` output before invoking the command"],"tags":["tauri-cli","acl","capabilities","identifier-mismatch","config-validation"],"backgroundTag":"capability-not-found","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}