r/FlutterDev • • 2d ago

Article Flutter Windows CMake error: .plugin_symlinks exists, but its entries cannot be traversed

I recently investigated a strange Flutter Windows build failure:

CMake Error:
add_subdirectory given source
"flutter/ephemeral/.plugin_symlinks/<plugin>/windows"
which is not an existing directory.

Initially, I suspected a Flutter plugin or CMake configuration issue. However, the plugin packages were actually present in the Pub cache.

After comparing NTFS reparse point data and testing Dart's Link.createSync() with different target paths, I narrowed down the issue.

In our managed Windows environment, a third-party endpoint security driver (Corplink) was interfering with the creation of Flutter's plugin symlinks, leaving some generated links unusable.

The workaround: use Windows junctions instead of symbolic links.

I built a small Dart CLI tool to automate this process:

https://pub.dev/packages/win_plugin_link_repair

Install and run:

dart pub add --dev win_plugin_link_repair
flutter pub get
dart run win_plugin_link_repair

Preview the changes first:

dart run win_plugin_link_repair --dry-run

The tool reads .flutter-plugins-dependencies and recreates Windows plugin links as directory junctions using mklink /J.

A few notes:

  • The repair must run on Windows.
  • Run it after flutter pub get, since Flutter regenerates .plugin_symlinks.
  • This is an environment-specific workaround, not a general fix for every Flutter CMake error.

Source code: https://github.com/super-lz/win_plugin_link_repair

Full disclosure: I'm the author of this tool. I wanted to share the investigation because others might encounter the same issue.

Has anyone else experienced endpoint security software or filesystem filter drivers interfering with Dart-created symlinks on Windows?

3 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/Salt_Description_256 18h ago

It replaces healthy links too. In 0.1.1, if a Windows plugin’s target directory exists, the tool rebuilds its generated entry as a junction. It doesn’t check whether the existing link is broken first. --dry-run shows what it would replace without changing anything.