evi
Blog

Engineering·Evi team·

How Evi makes sure you’re never locked out

A broken plugin shouldn’t cost you your Discord. Here’s how safe mode catches it and tells you exactly what happened.

Client mods run code inside Discord. That’s the whole point, and it’s also the risk: one bad plugin and Discord can crash every time it opens. With most mods, the fix is digging through folders to find and delete the culprit. Evi does that part for you.

Noticing the loop

Every time Discord starts, Evi adds one to a small counter on disk. Once your plugins are running and Discord has stayed up for five seconds, it resets the counter to zero. A healthy start leaves nothing behind.

A crash loop leaves the counter climbing. When the last two starts never made it to five seconds, Evi knows something is wrong before the third one begins.

Start
Didn’t finish
starts: 1
Start
Didn’t finish
starts: 2
Safe mode
Plugins, themes, Quick CSS off
starts: 3
A start counts as healthy once plugins are running and Discord has stayed up for 5 seconds. That resets the count to zero.
Two starts that never finished, and the third one comes up in safe mode.

Safe mode

On that next start, Evi loads in safe mode. Every plugin, theme and bit of Quick CSS stays off, official plugins included. Discord just works.

Then Evi tells you what happened, and names the change most likely to blame:

Evi is in safe mode
Discord didn’t finish starting the last 2 times, so Evi started it without plugins, themes or Quick CSS. Discord itself works normally.
Most recent change: Message Logger (plugin, turned on 5 minutes ago)
Disable Message Logger and restartExit safe mode and restart
The safe mode notice. It floats over Discord and also sits at the top of Evi’s Plugins tab.

From there it’s one click: turn that plugin off and restart, or leave safe mode if it was a fluke. You can still turn plugins on or off while in safe mode; the changes apply when you leave.

Naming the culprit

Evi keeps a short history of recent changes: a plugin turned on or its settings changed, a theme enabled, Quick CSS edited. The suspect is simply the newest change that’s still on. Turning something off can’t break anything, so that’s never recorded.

There’s one subtle case: a plugin that crashes Discord the instant you enable it. To make sure it still gets named, Evi writes the change to disk before any of the plugin’s code runs.

Even mid-session

The same goes for crashes while you’re using Discord. Two crashes within two minutes and Evi switches to safe mode on the spot, stops any native plugin code that’s running, and reloads the window instead of letting you fight it.

Up and running before a start counts as healthy
5 s
Unfinished starts before safe mode kicks in
2
Window for two crashes mid-session
2 min

And if even that isn’t enough

If safe mode doesn’t fix it, Evi stops loading entirely: after two more unfinished starts, the next one runs plain Discord. You can also ask for that yourself:

Terminal

Discord.exe --evi-safe    # one start in safe mode
Discord.exe --vanilla     # one start without Evi at all

A clean way out

Evi never edits Discord’s own files. Installing it sets Discord’s original app aside and puts a small loader in its place:

Discord, as shipped
resources/app.asar
Discord’s app
With Evi
resources/app.asar
Evi’s small loader
resources/_app.asar
The original, renamed and untouched

So uninstalling is just the reverse: evi uninstall removes the loader and puts the original back, in every Discord version folder it finds. Byte for byte, the file you started with. Your plugins and settings stay in %APPDATA%\Evi in case you come back.

Next post

Hello, Evi