MT5 build 6230 (portable mode) recursively deletes the whole %LOCALAPPDATA% folder when the disk is full


This has now happened three times: following a disk full event, something nuked the entire %LOCALAPPDATA% folder.

After the first time I set up extra logging to find out what happened, but the second occurrence didn't capture enough info.
So I added a file system level trigger, windows file-delete auditing on a test folder inside %LOCALAPPDATA%, to catch which process deletes it. The third occurrence pointed to the MT5 terminal.

Yes, I still need to address why the disk filled up, but I wanted to get to the bottom of this first. Here are the details:

When drive C: runs out of free space, a running MetaTrader 5 terminal deletes the entire contents of the Windows user's %LOCALAPPDATA% folder (C:\Users<user>\AppData\Local). That folder is outside the terminal's own data folder. Other applications' data, browser profiles, per-user program installs and Windows app aliases are all destroyed. Windows file-delete auditing confirmed the terminal process did the deletion.

ENVIRONMENT

  • MetaTrader 5 build 6230 (terminal64.exe, file version 5.0.0.6230)
  • PORTABLE MODE: the terminal runs with the /portable switch from its own folder, C:<path>\MT5- - \terminal64.exe. All terminal data is in that folder, not in AppData\Roaming\MetaQuotes.
  • Started by the official MetaTrader5 Python package (mt5.initialize(path=...)) and running for about 30 hours before the event. The process command line was: "C:/ /<path>/terminal64.exe" /portable
  • 4 portable terminals installed (all build 6230), one of them running in the user's desktop session
  • Windows 11 Pro 23H2 (10.0.22631), 64-bit
  • The terminal folder contains an "llm-agent" subfolder (created July 2026, after the AI Assistant builds) and temp\EBWebView

WHAT HAPPENED (2026-12-03, local time UTC+1)

  1. 00:08 Drive C: dropped below 0.4 GB free and then reached 0 bytes.
  2. 03:49:09 Windows Security auditing (event 4663, a delete-audit rule on a test folder inside %LOCALAPPDATA%) recorded every file in that test folder being deleted by one process: Process: C:<path>\MT5- - \terminal64.exe PID: 328, running as the logged-in user (not elevated) No other process deleted anything in it.
  3. The terminal also emptied its own logs folder (C:<path>\MT5-...\logs, inside the portable folder). Every daily log back to July 2026 was deleted. The folder now holds a single file, created at 03:50:10, whose first entry is: 03:49:33.464 HistoryCache ' ' container body read error [0] The other three terminals' logs folders still hold their full history, so this is not normal log rotation.
  4. By 03:53 about 28 GB had been freed. Almost all of %LOCALAPPDATA% was gone; only files locked by running programs remained.
  5. The terminal kept running and trading normally afterwards.

OBSERVED DELETION PATTERN The pattern matched two earlier occurrences on the same machine (2026-10-29 and 2026-11-30, both right after the disk reached 0 bytes free; the process was not identified then):

  • recursive, in alphabetical order through %LOCALAPPDATA%
  • about 1,700-2,000 files per second, finished within 1-3 minutes
  • files locked by other running programs survived
  • AppData\Roaming, Documents, ProgramData and other drives/folders were NOT touched
  • no new process was launched before the deletion, so it was done by an already-running process

The 2026-10-29 occurrence left the same trace in a different portable terminal (another broker, also build 6230). %LOCALAPPDATA% was deleted at 19:00-19:02. That terminal's logs folder lost every log since August, and a new log was started at 19:10:10 whose first entry is the same message: HistoryCache ' ' container body read error [0]

EXPECTED BEHAVIOUR On a disk-full / write error, the terminal should fail the write (and perhaps clean up its own cache inside its own portable folder). It should never delete files outside its data folder.

GUESS (unconfirmed) A cache or temp cleanup routine that runs after a write or read error, perhaps in the HistoryCache or AI Assistant / WebView component, builds its target path from a value that is empty or wrong in portable mode, so it resolves to %LOCALAPPDATA% itself instead of a subfolder. For example, a cleanup aimed at %LOCALAPPDATA%\Temp (or a MetaQuotes subfolder of it) that ends up one level too high. The same routine seems to empty the terminal's own logs folder.

Has anyone else seen this? If a moderator can reproduce it or knows of a related issue, please forward it to MetaQuotes.