<p dir="auto"><strong>Description:</strong></p>
<p dir="auto">When Deno is called from a directory that used to exist but doesn't anymore (i.e. deleted externally), it will panic.</p>
<p dir="auto"><strong>Steps to Reproduce:</strong></p>
<ol dir="auto">
<li><code class="notranslate">mkdir /tmp/testing &amp;&amp; cd /tmp/testing</code></li>
<li><code class="notranslate">deno</code> or <code class="notranslate">deno repl</code> or <code class="notranslate">deno run https://deno.land/std/examples/welcome.ts</code></li>
<li>Observe that it works</li>
</ol>
<p dir="auto">-<em>in another terminal</em>-</p>
<p dir="auto"><code class="notranslate">rm -rf /tmp/testing</code></p>
<p dir="auto">-<em>back to the original terminal</em>-</p>
<ol start="4" dir="auto">
<li>Re-run the command.</li>
<li>Observe panic.</li>
</ol>
<p dir="auto"><strong>Backtrace:</strong> <a href="https://github.com/denoland/deno/files/8908708/backtrace.txt">backtrace.txt</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="~ RUST_BACKTRACE=1 deno run -A cli.ts

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos x86_64
Version: 1.22.3
Args: [&quot;deno&quot;, &quot;run&quot;, &quot;-A&quot;, &quot;cli.ts&quot;]

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: &quot;No such file or directory&quot; }', core/module_specifier.rs:141:28
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: deno_core::module_specifier::resolve_path
   4: deno_core::module_specifier::resolve_url_or_path
   5: deno::run_command::{{closure}}
   6: deno::main::{{closure}}
   7: &lt;core::future::from_generator::GenFuture&lt;T&gt; as core::future::future::Future&gt;::poll
   8: deno_runtime::tokio_util::run_basic
   9: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace."><pre class="notranslate"><code class="notranslate">~ RUST_BACKTRACE=1 deno run -A cli.ts

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos x86_64
Version: 1.22.3
Args: ["deno", "run", "-A", "cli.ts"]

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', core/module_specifier.rs:141:28
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: deno_core::module_specifier::resolve_path
   4: deno_core::module_specifier::resolve_url_or_path
   5: deno::run_command::{{closure}}
   6: deno::main::{{closure}}
   7: &lt;core::future::from_generator::GenFuture&lt;T&gt; as core::future::future::Future&gt;::poll
   8: deno_runtime::tokio_util::run_basic
   9: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="~ RUST_BACKTRACE=full deno run -A cli.ts

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos x86_64
Version: 1.22.3
Args: [&quot;deno&quot;, &quot;run&quot;, &quot;-A&quot;, &quot;cli.ts&quot;]

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: &quot;No such file or directory&quot; }', core/module_specifier.rs:141:28
stack backtrace:
   0:        0x1023aaf8b - &lt;std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display&gt;::fmt::h4cae82d438451481
   1:        0x101a744eb - core::fmt::write::hb68c3045179d0cad
   2:        0x1023a51ae - std::io::Write::write_fmt::haf84c797e63d79f0
   3:        0x1023afde0 - std::panicking::default_hook::{{closure}}::he18137441e51da1f
   4:        0x1023afb01 - std::panicking::default_hook::ha3efe84526f027fa
   5:        0x101a076a1 - deno::setup_panic_hook::{{closure}}::h40c42abbafe06a7a
   6:        0x1023b0a40 - std::panicking::rust_panic_with_hook::h429a7ddefa5f0258
   7:        0x1023b0734 - std::panicking::begin_panic_handler::{{closure}}::h9b033a6b15b84a74
   8:        0x1023b06a9 - std::sys_common::backtrace::__rust_end_short_backtrace::hcdd3bec8e0e38aa6
   9:        0x1023b0665 - _rust_begin_unwind
  10:        0x1035ee173 - core::panicking::panic_fmt::hf7d6e5207e013f69
  11:        0x1035ee485 - core::result::unwrap_failed::h95d9e30ede493473
  12:        0x101b575eb - deno_core::module_specifier::resolve_path::hb9a126f04a986351
  13:        0x101b56cfc - deno_core::module_specifier::resolve_url_or_path::h85e8466bb4c632ef
  14:        0x1019648f3 - deno::run_command::{{closure}}::h4b081d1b1f5edb22
  15:        0x1016f4ceb - deno::main::{{closure}}::h9a70f756620d74a8
  16:        0x1016e8d8f - &lt;core::future::from_generator::GenFuture&lt;T&gt; as core::future::future::Future&gt;::poll::h75b1e0a291c5e2cc
  17:        0x1016e6049 - deno_runtime::tokio_util::run_basic::hd2be911e11342f3d
  18:        0x1016e5588 - deno::main::h3ebfe1366267437f
  19:        0x1016e4d9c - std::sys_common::backtrace::__rust_begin_short_backtrace::h366f15b72859e8b1
  20:        0x1016e505c - _main"><pre class="notranslate"><code class="notranslate">~ RUST_BACKTRACE=full deno run -A cli.ts

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos x86_64
Version: 1.22.3
Args: ["deno", "run", "-A", "cli.ts"]

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', core/module_specifier.rs:141:28
stack backtrace:
   0:        0x1023aaf8b - &lt;std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display&gt;::fmt::h4cae82d438451481
   1:        0x101a744eb - core::fmt::write::hb68c3045179d0cad
   2:        0x1023a51ae - std::io::Write::write_fmt::haf84c797e63d79f0
   3:        0x1023afde0 - std::panicking::default_hook::{{closure}}::he18137441e51da1f
   4:        0x1023afb01 - std::panicking::default_hook::ha3efe84526f027fa
   5:        0x101a076a1 - deno::setup_panic_hook::{{closure}}::h40c42abbafe06a7a
   6:        0x1023b0a40 - std::panicking::rust_panic_with_hook::h429a7ddefa5f0258
   7:        0x1023b0734 - std::panicking::begin_panic_handler::{{closure}}::h9b033a6b15b84a74
   8:        0x1023b06a9 - std::sys_common::backtrace::__rust_end_short_backtrace::hcdd3bec8e0e38aa6
   9:        0x1023b0665 - _rust_begin_unwind
  10:        0x1035ee173 - core::panicking::panic_fmt::hf7d6e5207e013f69
  11:        0x1035ee485 - core::result::unwrap_failed::h95d9e30ede493473
  12:        0x101b575eb - deno_core::module_specifier::resolve_path::hb9a126f04a986351
  13:        0x101b56cfc - deno_core::module_specifier::resolve_url_or_path::h85e8466bb4c632ef
  14:        0x1019648f3 - deno::run_command::{{closure}}::h4b081d1b1f5edb22
  15:        0x1016f4ceb - deno::main::{{closure}}::h9a70f756620d74a8
  16:        0x1016e8d8f - &lt;core::future::from_generator::GenFuture&lt;T&gt; as core::future::future::Future&gt;::poll::h75b1e0a291c5e2cc
  17:        0x1016e6049 - deno_runtime::tokio_util::run_basic::hd2be911e11342f3d
  18:        0x1016e5588 - deno::main::h3ebfe1366267437f
  19:        0x1016e4d9c - std::sys_common::backtrace::__rust_begin_short_backtrace::h366f15b72859e8b1
  20:        0x1016e505c - _main
</code></pre></div>