{"record":{"id":"0fe4cc3265984747","repo":"k1tbyte/Wand-Enhancer","slug":"invalid-wemod-path","errorCode":null,"errorMessage":"Invalid WeMod path","messagePattern":"Invalid WeMod path","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"WandEnhancer/Models/PatchConfig.cs","lineNumber":36,"sourceCode":"    public sealed class PatchConfig\n    {\n        private string _path;\n        public HashSet<EPatchType> PatchTypes { get; set; }\n\n        public List<string> CustomScriptPaths { get; set; } = new List<string>();\n        \n        public bool AutoApplyPatches { get; set; }\n        \n        [JsonIgnore]\n        public WeModConfig AppProps { get; private set; }\n\n        public string Path\n        {\n            get => _path;\n            set\n            {\n                _path = value;\n                AppProps = Extensions.CheckWeModPath(_path) ?? throw new Exception(\"Invalid WeMod path\");\n            }\n        }\n    }\n    \n}","sourceCodeStart":18,"sourceCodeEnd":41,"githubUrl":"https://github.com/k1tbyte/Wand-Enhancer/blob/643c8f8b62cbb26fd3ac105b92497d9a9c445f08/WandEnhancer/Models/PatchConfig.cs#L18-L41","documentation":"The PatchConfig.Path setter calls Extensions.CheckWeModPath(value), which scans Constants.WeModBrandNames ('Wand', 'WeMod') for a <name>.exe alongside resources/app.asar at that root. It returns null when neither brand's exe + asar pair is found, and the setter turns null into this throw. So the path is not a valid Wand/WeMod install root.","triggerScenarios":"Setting PatchConfig.Path to a directory where neither Wand.exe nor WeMod.exe exists next to resources/app.asar (Extensions.cs:12-38).","commonSituations":"User pointed Path at the launcher parent (which holds app-* subfolders) instead of the versioned app-<ver>/ folder; pointed at a shortcut/zip/empty dir; a fresh install that has not finished; typo in the path.","solutions":["Point Path at the directory that directly contains Wand.exe (or WeMod.exe) and resources/app.asar — typically %LOCALAPPDATA%/Wand/app-<version>/.","Prefer Extensions.FindWeMod() auto-detection instead of a manual path.","Complete or reinstall Wand so both files are present.","Pre-validate with File.Exists on <path>/Wand.exe and <path>/resources/app.asar before assigning."],"exampleFix":"// before\nconfig.Path = userTypedFolder; // throws if invalid\n// after\nvar checked_ = Extensions.CheckWeModPath(userTypedFolder);\nif (checked_ == null) {\n    // fall back to auto-detection or surface a friendly error\n    checked_ = Extensions.FindWeMod();\n}\nif (checked_ != null) config.Path = checked_.RootDirectory;","handlingStrategy":"validation","validationCode":"// Validate the install root before assigning it\nstatic bool IsValidInstall(string root) {\n    foreach (var brand in Constants.WeModBrandNames)\n        if (File.Exists(Path.Combine(root, brand + \".exe\"))\n            && File.Exists(Path.Combine(root, \"resources\", \"app.asar\")))\n            return true;\n    return false;\n}\nif (!IsValidInstall(userPath))\n    throw new ArgumentException(\"Not a Wand/WeMod install root: \" + userPath);","typeGuard":"static bool IsWeModInstallRoot(string root) {\n    if (string.IsNullOrWhiteSpace(root) || !Directory.Exists(root)) return false;\n    foreach (var brand in Constants.WeModBrandNames)\n        if (File.Exists(Path.Combine(root, brand + \".exe\"))\n            && File.Exists(Path.Combine(root, \"resources\", \"app.asar\")))\n            return true;\n    return false;\n}","tryCatchPattern":"try { config.Path = userPath; }\ncatch (Exception ex) when (ex.Message == \"Invalid WeMod path\") {\n    // offer Extensions.FindWeMod() auto-detection or a folder picker\n}","preventionTips":["Default to Extensions.FindWeMod() auto-detection; only ask for a path if it returns null.","Run IsWeModInstallRoot before assigning Path to fail with a friendly message.","Prefer folder pickers that start at %LOCALAPPDATA%/<brand>/app-<version>."],"tags":["config","validation","install-path"],"backgroundTag":null,"analyzedSha":"643c8f8b62cbb26fd3ac105b92497d9a9c445f08","analyzedAt":"2026-08-13T14:17:43.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}