Automatic backup and recovery for WeakAuras on WoW 3.3.5a (WotLK).
Protects your WeakAuras configuration from being permanently wiped when a forced disconnect corrupts WeakAuras.lua in SavedVariables.
Built for Warmane and other 3.3.5a private servers.
- The Problem
- Why .bak Does Not Help
- The Solution
- Installation
- Commands
- How It Works
- Example Output
- FAQ
- File Structure
- Compatibility
- Contributing
- Acknowledgments
If you run two WoW clients and log into the same account from the second client, the first client is forcefully disconnected. During shutdown, WoW attempts to write all addon data (SavedVariables) to disk:
Normal logout:
1. WoW serializes addon data
2. Renames old WeakAuras.lua -> WeakAuras.lua.bak
3. Creates new WeakAuras.lua
4. Writes all data to file
5. File closed, done
Forced disconnect:
1. WoW serializes addon data
2. Renames old WeakAuras.lua -> WeakAuras.lua.bak
3. Creates new WeakAuras.lua
4. Starts writing data... CLIENT KILLED
5. WeakAuras.lua = 1 KB of garbage (truncated)
WeakAuras.lua.bak = previous session's file
WeakAuras.lua often exceeds 5-30 MB, making it one of the largest SavedVariables files. The OS cannot flush that much data before the WoW process is terminated.
Result: All auras are permanently lost.
The common workaround is to delete the broken file and rename the .bak file. This fails in practice:
- WoW creates
.bakby renaming the currentWeakAuras.luabefore writing the new one. - If the current file was already corrupted from a previous force DC, the
.bakbecomes a copy of corrupted data. - After two consecutive forced disconnects, both files are destroyed.
This is a cascading failure. Once the .bak mechanism is compromised, it cannot recover.
WA_SafeGuard is a lightweight companion addon that:
- Stores a compressed backup of your WeakAuras data inside its own SavedVariables file.
- Automatically detects corruption on login and restores your SavedVariables from backup.
- Requires a single
/reloadafter auto-restore to apply the data in-game.
WoW writes SavedVariables files in alphabetical order:
WA_SafeGuard.lua ("WA_S...") -> written FIRST
WeakAuras.lua ("Weak...") -> written SECOND
On a forced disconnect:
WA_SafeGuard.lua(200-500 KB compressed) is fully written.WeakAuras.lua(5-30 MB) is interrupted.
The backup file is 3-5x smaller than the original due to:
- Cache stripping (removes auto-regenerated icon caches)
- Compact serialization (buffer-based writer, no whitespace)
- Huffman compression (via LibCompress, bundled with WeakAuras)
Small size + written first = survives the crash.
- Download the latest release or clone the repository.
- Extract or place the
WA_SafeGuardfolder into your WoW addons directory:WoW 3.3.5a/Interface/AddOns/WA_SafeGuard/ - Verify the structure:
Interface/AddOns/WA_SafeGuard/ ├── WA_SafeGuard.toc ├── WA_SafeGuard.lua └── README.md - Restart WoW or type
/reloadin-game. - Ensure the addon is enabled on the character selection screen.
Important: Install this addon while your WeakAuras are working correctly. The first backup is created on login. If your auras are already lost, reimport them first, then
/reload.
| Command | Description |
|---|---|
/wastatus |
Show current status: WA health, backup size, backup age |
/wasave |
Force an immediate backup of current auras |
/warestore |
Manually restore auras from the last good backup |
| Event | Action |
|---|---|
| Login (auras healthy) | Silently creates/updates backup |
| Login (auras corrupted) | Automatically overwrites SavedVariables with backup, prompts /reload |
| Zone change / Logout (clean) | Silently updates backup (via PLAYER_LEAVING_WORLD) |
| Zone change / Logout (auras corrupted) | Does nothing (preserves existing good backup) |
┌─────────────────── LOGIN ─────────────────────────────────────────┐
│ Is WeakAurasSaved a valid table with a displays subtable? │
│ ├─ YES (healthy) │
│ │ -> Strip caches from copy of WeakAurasSaved │
│ │ -> Serialize into compact Lua string │
│ │ -> Compress with LibCompress (if available) │
│ │ -> Store in WA_SafeGuardDB.data │
│ └─ NO (corrupted / missing) │
│ -> Check if WA_SafeGuardDB.data exists │
│ ├─ YES -> Decode/Decompress/Deserialize -> Restore -> /reload │
│ └─ NO -> Prompt manual reimport │
├─────────────────── LOGOUT ────────────────────────────────────────┤
│ Is WeakAurasSaved healthy? │
│ ├─ YES -> Silently update WA_SafeGuardDB │
│ └─ NO -> Do nothing │
└───────────────────────────────────────────────────────────────────┘
The addon uses a custom buffer-based serializer. Unlike WoW's default SavedVariables writer, it produces compact, valid Lua strings without indentation or verbose key formatting.
If LibCompress is available, the serialized string is Huffman-compressed and encoded. If unavailable, the raw string is stored.
Data is considered corrupted if:
WeakAurasSavedisnilor not a tableWeakAurasSaved.displaysis not a tableWeakAurasSaved.displaysis empty while a valid backup exists
- Sandboxed deserialization via
setfenv(fn, {}) - Size validation (>50 bytes) prevents treating empty backups as valid
- Never overwrites a good backup with corrupted data
pcallwraps all serialization/compression operations- 3-second login delay ensures all addons finish loading before backup runs
[SafeGuard] Loaded. Commands: /wastatus /wasave /warestore
[SafeGuard] Backup OK 142 auras ~1847KB
[SafeGuard] Loaded. Commands: /wastatus /wasave /warestore
[SafeGuard] == WeakAuras data is CORRUPTED! ==
[SafeGuard] RESTORED 142 auras!
[SafeGuard] Auras restored to SavedVariables. Type /reload to apply.
/wastatus
[SafeGuard] === Status ===
[SafeGuard] WeakAuras: OK (142 auras)
[SafeGuard] Backup: OK 142 auras ~538KB 12 min ago
The compressed backup is typically 3-5x smaller than the original data. This is a negligible tradeoff for data integrity.
Extremely unlikely due to alphabetical write order and smaller size. If it occurs, check WA_SafeGuard.lua.bak in your SavedVariables folder.
Built and tested for 3.3.5a (WotLK). May work on 2.4.3 or 4.3.4 if ## Interface is updated, but is untested.
No. The addon only activates when WeakAuras data is present.
Before logging into a second client, type /reload on the first. This forces a clean save of all SavedVariables.
No. This addon prevents future loss. Reimport your auras, then /reload. The addon will protect them moving forward.
On every login and logout, provided WeakAuras data is healthy. Use /wasave after adding new auras mid-session.
WA_SafeGuard/
├── WA_SafeGuard.toc
├── WA_SafeGuard.lua
└── README.md
WTF/Account/<ACCOUNT_NAME>/SavedVariables/
├── WA_SafeGuard.lua
├── WA_SafeGuard.lua.bak
├── WeakAuras.lua
└── WeakAuras.lua.bak
| Feature | Value |
|---|---|
| WoW Version | 3.3.5a (WotLK) |
| Interface | 30300 |
| Tested On | Warmane (Lordaeron, Icecrown, Frostmourne) |
| WeakAuras | Required |
| LibCompress | Optional (bundled with WeakAuras) |
| Conflicts | None known |
- Open an issue describing the bug or feature.
- Fork the repository and create a branch.
- Commit changes following standard Lua/WoW conventions.
- Submit a Pull Request with a clear description.
- WeakAuras for WotLK
- The Warmane community for stress-testing this edge case.
Developed to solve a persistent WeakAuras data loss issue on private servers. MIT License.