Skip to content

Dart error - Invocation: 'dart run' Exception: FileSystemException #60882

Open
@camstuart

Description

@camstuart

OS: mac 15.5 (24F74)
Dart SDK version: 3.8.1 (stable) (Wed May 28 00:47:25 2025 -0700) on "macos_arm64"

Background:
I am building a cli app, and attempting to use an external file watcher (watchexec 2.3.2 (2025-05-18)) to run my cli app on file change.

Error:
I have tried multiple methods with debounce / sleep but cannot get this to work, the following commands:

watchexec -n --stop-timeout 5s -- dart run
watchexec -- 'sleep 3; dart run'
watchexec --debounce 500ms --exts dart -- dart run

All result in the same error:

An unexpected error was encountered by the Dart CLI.
Please file an issue at https://github.com/dart-lang/sdk/issues/new with the following details:

Invocation: 'dart run'
Exception: 'FileSystemException: Failed to get type of stdio handle (fd 1), path = '' (OS Error: Bad file descriptor, errno = 9)'
Stack Trace:
#0      _StdIOUtils._getStdioOutputStream (dart:io-patch/stdio_patch.dart:35:7)
#1      _stdout (dart:io/stdio.dart:505:36)
#2      _stdout (dart:io/stdio.dart)
#3      stdout (dart:io/stdio.dart:532:41)
#4      dartdevUsageLineLength (package:dartdev/src/utils.dart:19:5)
#5      globalDartdevOptionsParser (package:dartdev/src/utils.dart:76:22)
#6      new DartdevRunner (package:dartdev/dartdev.dart:89:21)
#7      runDartdev (package:dartdev/dartdev.dart:46:20)
#8      main (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:13:11)
#9      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:310:33)
#10     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:193:12)

[Command exited with 255]

Is this truly an issue with dartdev? or is there an alternative approach to solving this?

I am having the same problem when attempting to run tests on file change as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions