{"record":{"id":"05adad0288ea3418","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"could-not-find-a-tweak-with-this-name-to-uninstall","errorCode":null,"errorMessage":"Could not find a tweak with this name to uninstall","messagePattern":"Could not find a tweak with this name to uninstall","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"source/ScriptHelper/Program.cs","lineNumber":33,"sourceCode":"    {\n        private static QueryType _queryType;\n        private static string _appId;\n\n        [STAThread]\n        private static int Main(string[] args)\n        {\n            HelperTools.SetupEncoding();\n\n            try\n            {\n                ProcessCommandlineArguments(args);\n\n                switch (_queryType)\n                {\n                    case QueryType.Uninstall:\n                        Console.WriteLine(\"Uninstalling \" + _appId);\n                        var tweakEntry = Tweaks.GetEntry(_appId);\n                        if (tweakEntry == null) throw new ArgumentException(\"Could not find a tweak with this name to uninstall\");\n                        tweakEntry.OnUninstall(true);\n                        break;\n                    case QueryType.List:\n                        foreach (var result in Tweaks.GetConsoleOutput())\n                        {\n                            var converted = result.Select(x => new KeyValuePair<string, object>(x.Key, x.Value)).ToList();\n                            Console.WriteLine(HelperTools.KeyValueListToConsoleOutput(converted));\n                        }\n                        break;\n                    default:\n                        Console.WriteLine(\"Accepted commands:\\nlist\\nuninstall <id>\");\n                        break;\n                }\n            }\n            catch (OperationCanceledException)\n            {\n                return (int)ResultWin32.ERROR_CANCELLED;\n            }","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/ScriptHelper/Program.cs#L15-L51","documentation":"Thrown by ScriptHelper's Main when, in the 'uninstall' command branch, Tweaks.GetEntry(_appId) returns null - i.e. no tweak is registered under the supplied id. It is an ArgumentException, caught by the generic handler which maps it to an unexpected-error return code (ResultWin32.ERROR_UNEXP_NET_ERR), so the process exits non-zero.","triggerScenarios":"Running 'ScriptHelper uninstall <id>' where <id> is not a tweak id that Tweaks.GetEntry recognizes; passing the display name instead of the internal id; the tweak list changed and the id was removed or renamed.","commonSituations":"Calling the helper with a stale id read from an older config; typos in the id string; version mismatch between the host application's stored ids and the ScriptHelper build's compiled tweak set.","solutions":["Run 'ScriptHelper list' first and use one of the ids it prints.","Confirm the ScriptHelper build matches the version that registered the tweak id you are passing.","Wrap the call and treat a non-zero exit / ArgumentException as 'already removed' if re-running an uninstall script."],"exampleFix":"// before\nScriptHelper.exe uninstall MyAppTweakId\n// -> 'Could not find a tweak with this name to uninstall'\n\n// after\nScriptHelper.exe list\n# pick a real id from the output, then:\nScriptHelper.exe uninstall <real-id>","handlingStrategy":"validation","validationCode":"// Before invoking ScriptHelper, confirm the id is in its list output.\nvar ids = RunScriptHelper(\"list\").ParseIds();\nif (!ids.Contains(appId, StringComparer.OrdinalIgnoreCase))\n    return; // nothing to uninstall","typeGuard":null,"tryCatchPattern":"try { Tweaks.GetEntry(_appId)?.OnUninstall(true); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Could not find a tweak\"))\n{ /* id not registered; log and treat as already uninstalled */ }","preventionTips":["Always run 'list' before 'uninstall' to confirm valid ids.","Keep the ScriptHelper build in sync with the host that registered tweaks.","Treat the ArgumentException / non-zero exit as idempotent in re-runnable scripts."],"tags":["script-helper","cli","tweaks","argument-validation","csharp"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}