k1tbyte/Wand-Enhancer · error · Exception

Invalid WeMod path

Error message

Invalid WeMod path

What it means

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.

Source

Thrown at WandEnhancer/Models/PatchConfig.cs:36

    public sealed class PatchConfig
    {
        private string _path;
        public HashSet<EPatchType> PatchTypes { get; set; }

        public List<string> CustomScriptPaths { get; set; } = new List<string>();
        
        public bool AutoApplyPatches { get; set; }
        
        [JsonIgnore]
        public WeModConfig AppProps { get; private set; }

        public string Path
        {
            get => _path;
            set
            {
                _path = value;
                AppProps = Extensions.CheckWeModPath(_path) ?? throw new Exception("Invalid WeMod path");
            }
        }
    }
    
}

View on GitHub (pinned to 643c8f8b62)

Solutions

  1. Point Path at the directory that directly contains Wand.exe (or WeMod.exe) and resources/app.asar — typically %LOCALAPPDATA%/Wand/app-<version>/.
  2. Prefer Extensions.FindWeMod() auto-detection instead of a manual path.
  3. Complete or reinstall Wand so both files are present.
  4. Pre-validate with File.Exists on <path>/Wand.exe and <path>/resources/app.asar before assigning.

Example fix

// before
config.Path = userTypedFolder; // throws if invalid
// after
var checked_ = Extensions.CheckWeModPath(userTypedFolder);
if (checked_ == null) {
    // fall back to auto-detection or surface a friendly error
    checked_ = Extensions.FindWeMod();
}
if (checked_ != null) config.Path = checked_.RootDirectory;
Defensive patterns

Strategy: validation

Validate before calling

// Validate the install root before assigning it
static bool IsValidInstall(string root) {
    foreach (var brand in Constants.WeModBrandNames)
        if (File.Exists(Path.Combine(root, brand + ".exe"))
            && File.Exists(Path.Combine(root, "resources", "app.asar")))
            return true;
    return false;
}
if (!IsValidInstall(userPath))
    throw new ArgumentException("Not a Wand/WeMod install root: " + userPath);

Type guard

static bool IsWeModInstallRoot(string root) {
    if (string.IsNullOrWhiteSpace(root) || !Directory.Exists(root)) return false;
    foreach (var brand in Constants.WeModBrandNames)
        if (File.Exists(Path.Combine(root, brand + ".exe"))
            && File.Exists(Path.Combine(root, "resources", "app.asar")))
            return true;
    return false;
}

Try / catch

try { config.Path = userPath; }
catch (Exception ex) when (ex.Message == "Invalid WeMod path") {
    // offer Extensions.FindWeMod() auto-detection or a folder picker
}

Prevention

When it happens

Trigger: Setting PatchConfig.Path to a directory where neither Wand.exe nor WeMod.exe exists next to resources/app.asar (Extensions.cs:12-38).

Common situations: 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.


AI-assisted analysis of k1tbyte/Wand-Enhancer@643c8f8b62 (2026-08-13). Data as JSON: /api/errors/0fe4cc3265984747. Report an issue: GitHub.