flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
164.56k stars 27.13k forks source link

[tool_crash] FileSystemException: Cannot delete file, OS Error: Permission denied, errno = 13 #152130

Open alaajaddou opened 1 month ago

alaajaddou commented 1 month ago

Command

flutter --no-color run --machine --track-widget-creation --device-id=8b5ddc6e --start-paused --dart-define=flutter.inspector.structuredErrors=true lib/main.dart

Steps to Reproduce

  1. ...
  2. ...
  3. ...

Logs

FileSystemException: Cannot delete file, OS Error: Permission denied, errno = 13

#0      _File.throwIfError (dart:io/file_impl.dart:675:7)
#1      _File._deleteSync (dart:io/file_impl.dart:329:5)
#2      FileSystemEntity.deleteSync (dart:io/file_system_entity.dart:407:7)
#3      ForwardingFileSystemEntity.deleteSync (package:file/src/forwarding/forwarding_file_system_entity.dart:70:16)
#4      ForwardingFileSystemEntity.deleteSync (package:file/src/forwarding/forwarding_file_system_entity.dart:70:16)
#5      ErrorHandlingFileSystem.deleteIfExists (package:flutter_tools/src/base/error_handling_io.dart:84:14)
#6      _writeFlutterPluginsListLegacy (package:flutter_tools/src/flutter_plugins.dart:259:36)
#7      refreshPluginsList (package:flutter_tools/src/flutter_plugins.dart:1009:30)
<asynchronous suspension>
#8      FlutterProject.ensureReadyForPlatformSpecificTooling (package:flutter_tools/src/project.dart:367:5)
<asynchronous suspension>
#9      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1736:7)
<asynchronous suspension>
#10     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1394:27)
<asynchronous suspension>
#11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#12     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#13     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:372:9)
<asynchronous suspension>
#14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#15     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:308:5)
<asynchronous suspension>
[!] Flutter (Channel stable, 3.22.3, on macOS 14.5 23F79 darwin-arm64, locale en-PS)
    • Flutter version 3.22.3 on channel stable at /Users/aj/Developer/flutter
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.3.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/aj/Developer/flutter. Consider adding /Users/aj/Developer/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0850beeb2 (6 days ago), 2024-07-16 21:43:41 -0700
    • Engine revision 235db911ba
    • Dart version 3.4.4
    • DevTools version 2.34.3
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/aj/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Users/aj/Library/Java/JavaVirtualMachines/corretto-17.0.10/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment Corretto-17.0.10.7.1 (build 17.0.10+7-LTS)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    ✗ Unable to get list of installed Simulator runtimes.
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Users/aj/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Users/aj/Applications/Android Studio.app
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.4)
    • IntelliJ at /Users/aj/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 80.0.2
    • Dart plugin version 241.18808

[✓] Connected device (4 available)
    • 23124RA7EO (mobile)             • 8b5ddc6e              • android-arm64  • Android 14 (API 34)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 126.0.6478.127

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Flutter Application Metadata

Type: app Version: 1.0.0+1 Material: true Android X: false Module: false Plugin: false Android package: null iOS bundle identifier: null Creation channel: stable Creation framework version: ba393198430278b6595976de84fe170f553cc728

Plugins

flutter_native_splash-2.4.1 rive_common-0.4.9

darshankawar commented 1 month ago

@alaajaddou does the user you are running the tool as, have permissions to write to the directory where your flutter project is?

alaajaddou commented 1 month ago

@alaajaddou does the user you are running the tool as, have permissions to write to the directory where your flutter project is?

sorry for late response, yes I do. the file creation was by me, and permission I do have the read|write permissions.

darshankawar commented 1 month ago

Keeping open for team's tracking.

andrewkolos commented 2 weeks ago

Technical: This probably should have been caught and resulted in a graceful tool exit by https://github.com/flutter/flutter/blob/af913a75b5d28b03f0bfe0ee44f9343ae26ae146/packages/flutter_tools/lib/src/base/error_handling_io.dart#L747.

However, I'm guessing that the underlying FileSystemEntity here was not a ErrorHandlingFile, when it should have been one.