{"record":{"id":"c26fcc7a81488cc9","repo":"tonhowtf/omniget","slug":"nao-da-para-alterar-este-item","errorCode":null,"errorMessage":"nao da para alterar este item","messagePattern":"nao da para alterar este item","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/startup.rs","lineNumber":269,"sourceCode":"            } else {\n                run(\n                    \"osascript\",\n                    &[\n                        \"-e\",\n                        &format!(\n                            \"tell application \\\"System Events\\\" to delete login item \\\"{}\\\"\",\n                            item.name.replace('\"', \"\\\\\\\"\")\n                        ),\n                    ],\n                )\n                .await?;\n                removed.retain(|(n, _)| *n != item.name);\n                removed.push((item.name.clone(), item.path.clone()));\n            }\n            save_removed(&removed);\n            Ok(())\n        }\n        _ => Err(anyhow!(\"nao da para alterar este item\")),\n    }\n}\n\n// ── Windows ────────────────────────────────────────────────────────────\n\nconst WIN_RUN: &[(&str, &str, &str)] = &[\n    (\n        r\"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\",\n        \"run\",\n        \"user\",\n    ),\n    (\n        r\"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce\",\n        \"run-once\",\n        \"user\",\n    ),\n    (\n        r\"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\",","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/startup.rs#L251-L287","documentation":"mac_set handles only specific macOS startup-item kinds (login items and a limited set of other item types); the final match arm is a catch-all that rejects anything else with this message. It means the requested enable/disable operation is not supported for that particular item kind on macOS.","triggerScenarios":"Calling set_enabled on a startup item whose kind is not handled by mac_set's match — e.g. LaunchAgents/LaunchDaemons or other item categories that the function only knows how to list, not toggle.","commonSituations":"UI showing all discovered startup items (including launchd agents) with toggle switches, but only native login items are actually toggleable via System Events; users trying to disable system LaunchAgents that macOS intentionally protects; app version where listing gained new item kinds before set_enabled gained matching arms.","solutions":["Hide or disable the toggle in the UI for item kinds mac_set cannot change (only offer enable/disable for native login items)","Extend mac_set with arms that unload/load launchd jobs (launchctl bootout/bootstrap) for LaunchAgent/LaunchDaemon kinds","Return a clearer error that includes the unsupported item kind to help users understand why the toggle failed","Ensure mac_items only reports items whose kind mac_set supports, keeping list and mutate capabilities in sync"],"exampleFix":"// before\n_ => Err(anyhow!(\"nao da para alterar este item\")),\n// after: actionable message naming the kind\n_ => Err(anyhow!(\"nao da para alterar este item (tipo: {:?}); apenas itens de login sao suportados\", item.kind)),","handlingStrategy":"type-guard","validationCode":"// Only show toggles for kinds mac_set can change\nconst TOGGLABLE_KINDS: &[ItemKind] = &[ItemKind::LoginItem];\nif !TOGGLABLE_KINDS.contains(&item.kind) {\n    // render as read-only instead of calling set_enabled\n}","typeGuard":"fn is_togglable(item: &StartupItem) -> bool {\n    matches!(item.kind, ItemKind::LoginItem)\n}","tryCatchPattern":"match set_enabled(item, true).await {\n    Ok(_) => refresh_items(),\n    Err(e) if e.to_string().contains(\"nao da para alterar este item\") => {\n        eprintln!(\"Este tipo de item nao pode ser alternado pelo app\");\n        // fall back to opening System Settings > Login Items\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep mac_items and mac_set in sync: list only kinds set_enabled supports","Disable or hide toggle UI for LaunchAgents/LaunchDaemons and other non-login-item kinds","Include the item kind in the error message so users know what failed and why","Offer launchctl bootout/bootstrap support if toggling launchd jobs is a requirement"],"tags":["macos","login-items","rust","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}