Repository navigation
Description
During flutter run, DevFS.create calls FlutterVmService.createDevFS and only handles RPCError codes for service disconnection or 1001 (kFileSystemAlreadyExists), rethrowing all other RPC errors.
When the target Dart VM fails to create the DevFS temporary directory in Directory.systemTemp.createTemp (most commonly on Windows when %LOCALAPPDATA%\Temp or %TEMP% fails with PathAccessException: Creation of temporary directory failed (OS Error: Access is denied, errno = 5), or on iOS Simulator with errno = 28 No space left on device), the VM service returns JSON-RPC -32603 (Internal error). Because HotRunner._updateDevFS only catches DevFSException, the raw RPCError escapes RunCommand.runCommand and reports an unhandled tool crash (RPCError at new _OutstandingRequest at package:vm_service/src/vm_service.dart-58fe5aaf).
Target VM error (rpcError.details):
_createDevFS: (-32603) Internal error
_createDevFS: Unexpected exception:PathAccessException: Creation of temporary directory failed, path = 'C:\Users\<user>\AppData\Local\Temp' (OS Error: Access is denied, errno = 5)
Tool stack trace:
#0 new _OutstandingRequest (package:vm_service/src/vm_service.dart:278:32)
#1 VmService._call.<anonymous closure> (package:vm_service/src/vm_service.dart:1960:25)
#2 VmService._call (package:vm_service/src/vm_service.dart:1972:8)
#3 VmService.callServiceExtension (package:vm_service/src/vm_service.dart:1911:14)
#4 FlutterVmService.createDevFS (package:flutter_tools/src/vmservice.dart:954:18)
#5 DevFS.create (package:flutter_tools/src/devfs.dart:523:39)
#6 FlutterDevice.setupDevFS (package:flutter_tools/src/resident_runner.dart:345:23)
#7 HotRunner._initDevFS (package:flutter_tools/src/run_hot.dart:479:25)
#8 HotRunner._attach (package:flutter_tools/src/run_hot.dart:288:27)
#10 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:961:27)
DevFS.create should surface _createDevFS filesystem failures as a DevFSException or ToolExit with the underlying rpcError.details message so users can fix their TEMP/TMP directory permissions or disk space without crashing flutter_tools.
Related Issues & PRs
- [tool_crash] RPCError #194559
- [tool_crash] RPCError #194845
- [tool_crash] RPCError #195435
- DevFS restricted access to /tmp on MacOS Ventura 13.7.7 #173450
- macOS hot restart fails writing DevFS files into a sandboxed app container #193907
- [flutter_tools] Redirect macOS sandbox container DevFS to application_darwin_temp_dir #195328
Activity
[flutter_tools] Handle target VM filesystem errors in DevFS.create (f…
[stable] [flutter_tools] Handle target VM filesystem errors in DevFS.…
[stable] [flutter_tools] Handle target VM filesystem errors in DevFS.…