Skip to content

[flutter_tools] PathNotFoundException in IOSCoreDeviceControl and Xcode Build temp directory cleanup #186954

Closed

Description

@bkonyi

Description

While PR #140842 successfully fixed PathNotFoundException in IOSCoreDeviceControl._listCoreDevices by introducing ErrorHandlingFileSystem.deleteIfExists, several other methods in the same class still rely on synchronous tempDirectory.deleteSync(recursive: true).

In high-frequency local testing environments, CI/CD systems, or during race conditions, these directories can be removed asynchronously (e.g., by background system cleanups or parallel tasks). When the finally block tries to clean up, it triggers an unchecked PathNotFoundException, leading to a crash.

Affected Code Locations

  1. packages/flutter_tools/lib/src/ios/core_devices.dart at lines 527, 604, 652, and 747.
  2. packages/flutter_tools/lib/src/ios/mac.dart at line 595.

Expected Behavior

The tool should utilize ErrorHandlingFileSystem.deleteIfExists to prevent throwing an uncaught PathNotFoundException if the directory was already deleted by the OS or a concurrent task during build cleanup.

Activity

  1. bkonyi commented on May 22, 2026

    @bkonyi
    ContributorAuthor

    Closed in favor of the unified global FileSystem Robustness Initiative tracking issue #186959.

  2. github-actions commented on Jul 14, 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 Jul 14, 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

    team-toolOwned by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions