Skip to content

Error: EPERM: operation not permitted, open 'C:\Users\Bartosek Stanislav\AppData\Roaming\termpolis\mcp-token' #40

Closed

Description

@sentry

Sentry Issue: ELECTRON-13

Error: EPERM: operation not permitted, open 'C:\Users\Bartosek Stanislav\AppData\Roaming\termpolis\mcp-token'
  File "app:///out/main/index.js", line 9842, in writeSecureFile
    writeFileSync(path2, content, { encoding: "utf-8", mode: 384 });
  File "app:///out/main/index.js", line 12113

This issue was automatically created by Sentry via Auto-file Production crashes

Activity

  1. added
    bugSomething isn't working
    sentryAuto-created from Sentry crash report
    on Oct 27, 2026
  2. codedev-david commented on Oct 27, 2026

    @codedev-david
    Owner

    Already fixed in v1.53.0; the build that reported this is v1.52.x or older.

    Cause. Before v1.53.0, the token file was locked down in two icacls calls. The first removed the inherited permissions. The second granted access to the account name with every space and non-ASCII character stripped out, so Bartosek Stanislav became BartosekStanislav. No account has that name, so the grant failed and left mcp-token with an empty ACL. On the next launch even its owner could not open it, which is this EPERM. The stack trace matches that older code (writeSecureFile calling writeFileSync itself, with inline options).

    Fix (v1.53.0, src/main/secureFile.ts).

    • One icacls call, given the real account name (DOMAIN\Bartosek Stanislav), never an edited one.
    • A token file an older version locked its owner out of is granted back, deleted and written anew (replaceIfLocked).
    • The write is wrapped, so a failure is logged instead of thrown.

    Tests cover an account name with a space (tests/electron/secureFile.test.ts).

    For the affected install. The window and the auto-updater start before the crashing write, so the update to the current release (v1.54.3) still downloads. It installs on quit, and the next launch repairs the file. Until then, agents can't use Termpolis's MCP tools on that machine. Deleting %APPDATA%\termpolis\mcp-token also clears it. If the error appears again on v1.53.0 or later, reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageAwaiting initial reviewsentryAuto-created from Sentry crash report

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions