Skip to content

[tool_crash] Unhandled ProcessPackageException (OS Error 206: The filename or extension is too long) in _DefaultPub._preloadPubCache #194570

Description

@bkonyi

Summary

flutter pub get crashes on Windows with an unhandled ProcessPackageException (ProcessException: The filename or extension is too long, OS error code 206 / ERROR_FILENAME_EXCED_RANGE) in _DefaultPub._preloadPubCache (package:flutter_tools/src/dart/pub.dart:645) / ErrorHandlingProcessManager.runSync (package:flutter_tools/src/base/error_handling_io.dart:1310).

Crash Telemetry (Flutter stable/3.47.7)

  • Signature: ProcessPackageException at LocalProcessManager.runSync at package:process/src/interface/local_process_manager.dart-313da74f
  • Rank: fix syntax error #10 Top Crasher in 3.47.7
  • Total Occurrences: 19 (3.7% of Top 10, 1.9% of all 3.47.7 crashes, ~2.5 crashes/day)
  • Platform Distribution: Windows: 19 (100.0%)
  • Sample Command: flutter pub get
  • Error:
ProcessException: The filename or extension is too long (at ../../runtime/bin/process_win.cc:579) | Command: C:\Users\User\AppData\Local\Temp\claude\d--Dotlinker-Laravel-New-Set...

Stack Trace

#0      LocalProcessManager.runSync (package:process/src/interface/local_process_manager.dart:118)
#1      ErrorHandlingProcessManager.runSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:1310)
#2      _runSync (package:flutter_tools/src/base/error_handling_io.dart:1118)
#3      ErrorHandlingProcessManager.runSync (package:flutter_tools/src/base/error_handling_io.dart:1308)
#4      _DefaultPub._preloadPubCache (package:flutter_tools/src/dart/pub.dart:645)
#5      _DefaultPub._getPubCacheIfAvailable (package:flutter_tools/src/dart/pub.dart:624)
#6      _DefaultPub._createPubEnvironment (package:flutter_tools/src/dart/pub.dart:664)
#7      _DefaultPub._runWithStdioInherited (package:flutter_tools/src/dart/pub.dart:379)

Root Cause

  1. In _DefaultPub._preloadPubCache (package:flutter_tools/src/dart/pub.dart), flutter_tools passes all .tar.gz archive paths in $FLUTTER_ROOT/.pub-preload-cache to a single _processManager.runSync(<String>[..._pubCommand, 'cache', 'preload', ...cacheFiles]) invocation. When the Flutter SDK or current working directory is located in a deep Windows path (or the concatenated .tar.gz paths exceed Windows CreateProcessW / MAX_PATH limits in runtime/bin/process_win.cc), Windows fails with error code 206 (ERROR_FILENAME_EXCED_RANGE: The filename or extension is too long).
  2. In _handleWindowsException (package:flutter_tools/src/base/error_handling_io.dart:1467-1522), error code 206 is not listed in the switch (errorCode) statement, so _onProcessException returns without throwing a ToolExit and _runSync rethrows the raw ProcessPackageException.

Recommendation

  1. Add const kFilenameExcedRange = 206; (ERROR_FILENAME_EXCED_RANGE) to _handleWindowsException in package:flutter_tools/src/base/error_handling_io.dart so process/filesystem calls failing with error code 206 exit cleanly with a ToolExit instructing the user to move the project/SDK to a shorter path or enable Windows Long Paths.
  2. In _DefaultPub._preloadPubCache (package:flutter_tools/src/dart/pub.dart), batch cacheFiles (or run with workingDirectory: preloadCacheDir.path using relative archive filenames) so dart pub cache preload does not exceed Windows command-line / path length limits.

Activity

  1. added
    c: crashStack traces logged to the console
    toolAffects the "flutter" command-line tool. See also t: labels.
    P1High-priority issues at the top of the work list
    team-toolOwned by Flutter Tool team
    triaged-toolTriaged by Flutter Tool team
    on Oct 16, 2026
  2. github-actions commented on Nov 4, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  3. locked as resolved and limited conversation to collaborators on Nov 4, 2026
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

    P1High-priority issues at the top of the work listc: crashStack traces logged to the consolefound in release: 3.47Found to occur in 3.47t: top-crasherteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions