vitest: Node Error FATAL ERROR: v8::FromJust Maybe value is Nothing, on Windows (local) and CI build (Linux)

Describe the bug

Running “npx vitest run” results in a Node error that repro’s about half the time. Usually, all the tests are reported as passing before Node spits out this error. The error appears for me locally on Windows 10, but also causes our Linux (Ubuntu) CI build to fail. My viteconfig file is pretty vanilla, the only slightly abnormal thing I’m using is scss additionalData. I am trying my best to get a sandboxed reproduction, but this is for a corporate project so I am unable to share my full repo. I understand that a full sandbox is required for the bug to be addressed, but I am desperate and confused, and am hoping someone might be able to at least point me in the right direction. I love vite and vitest and this is the last thing preventing me from getting my team onto it.

Below is the output I am seeing:

√ src/scenes/App/advanced-reporting/advanced-reporting-list-view/advanced-reporting-list-view.test.tsx (2 tests) 443ms √ src/components/create-quick-topic-report-modal/create-quick-topic-report-modal.test.tsx (5 tests) 949ms √ src/components/workplace-reactions-aggregate-card/workplace-reactions-aggregate-card.test.tsx (10 tests ) 1002ms FATAL ERROR: v8::FromJust Maybe value is Nothing.

Test Files 6 passed (6) Tests 33 passed (33) Time 17.04s (in thread 2.95s, 577.09%)

1: 00007FF60749815F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+114079 2: 00007FF6074254C6 DSA_meth_get_flags+65542 3: 00007FF60742637D node::OnFatalError+301 4: 00007FF607D46415 v8::V8::FromJustIsNothing+53 5: 00007FF6073423FA v8::internal::MicrotaskQueue::microtasks_policy+22170 6: 00007FF60734229D v8::internal::MicrotaskQueue::microtasks_policy+21821 7: 00007FF6072B2BAD v8::internal::OrderedHashTablev8::internal::OrderedNameDictionary,3::NextTableOffset +58157 8: 00007FF6072B0623 v8::internal::OrderedHashTablev8::internal::OrderedNameDictionary,3::NextTableOffset +48547 9: 00007FF6072B37CD v8::internal::OrderedHashTablev8::internal::OrderedNameDictionary,3::NextTableOffset +61261 10: 00007FF6074962E5 v8::internal::CodeObjectRegistry::~CodeObjectRegistry+106277 11: 00007FF60747E899 v8::internal::CodeObjectRegistry::~CodeObjectRegistry+9433 12: 00007FF6074EC4A8 uv_check_init+120 13: 00007FF6074F7168 uv_run+664 14: 00007FF6074C5E05 node::SpinEventLoop+309 15: 00007FF60735DEC0 v8::internal::interpreter::BytecodeLabel::bind+35776 16: 00007FF607359518 v8::internal::interpreter::BytecodeLabel::bind+16920 17: 00007FF6074E766D uv_poll_stop+557 18: 00007FF608300940 v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+146416 19: 00007FFD49347034 BaseThreadInitThunk+20 20: 00007FFD4A282651 RtlUserThreadStart+33

Reproduction

run “npx vite run” on Windows 10 with the following vite config (changing scss additional data to pull in a scss file of your choosing)

/// <reference types="vitest" /> import { defineConfig, splitVendorChunkPlugin } from “vite”; import { inspectorServer } from “react-dev-inspector/plugins/vite”; import react from “@vitejs/plugin-react”;

export default defineConfig({ test: { globals: true, environment: “jsdom”, }, plugins: [ react(), splitVendorChunkPlugin(), ], css: { preprocessorOptions: { scss: { additionalData: @use "sass:math"; @import "scss/_aw-tools-and-vars-complete"; } } }, server: { port: 8080, strictPort: true, }, build: { sourcemap: true, } }

);

System Info

System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 13.13 GB / 31.83 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 100.0.4896.127
    Edge: Spartan (44.19041.1266.0), Chromium (100.0.1185.50)
    Internet Explorer: 11.0.19041.1202
  npmPackages:
    @vitejs/plugin-react: 1.3.1 => 1.3.1
    vite: 2.9.5 => 2.9.5
    vitest: 0.10.0 => 0.10.0

Used Package Manager

yarn

Validations

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 11
  • Comments: 23 (9 by maintainers)

Commits related to this issue

Most upvoted comments

The fix is listed in v16.17.0 proposal, scheduled for August 16th.

The fix for v14 was already backported, and available on staging. Probably will be publically available with the next security release.

@sheremet-va out of curiosity, which entry in the changelog is this fix exactly?

Under “Semver-patch commits”:

Here’s an example where it happened on Node 18: https://github.com/fwouts/previewjs/runs/7225194827?check_suite_focus=true

I’m also seeing this on vitest 0.17.0 (ubuntu-latest on GitHub Actions).

Still happening on vitest 0.12.6 (Windows 10) for me.

it’s looking good so far! I will run a few more CI builds tomorrow to validate but I think you got it! Thank you so much!

Per https://github.com/nodejs/node/issues/43617#issuecomment-1170545990, using Node 18 in my GitHub workflow resolved the issue.

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
+     - uses: actions/setup-node@v3
+       with:
+         node-version: 18

I’m seeing this on Mac OS 12.4 too

FATAL ERROR: v8::FromJust Maybe value is Nothing.
 1: 0x1025d42dc node::Abort() [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
 2: 0x1025d4464 node::errors::TryCatchScope::~TryCatchScope() [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
 3: 0x102725900 v8::V8::FromJustIsNothing() [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
 4: 0x1025d727c node::fs::FileHandle::CloseReq::Resolve() [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
 5: 0x1025e9f84 node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
 6: 0x102e42794 uv__work_done [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
 7: 0x102e45f30 uv__async_io [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
 8: 0x102e57ca8 uv__io_poll [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
 9: 0x102e463c0 uv_run [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
10: 0x102522ccc node::SpinEventLoop(node::Environment*) [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
11: 0x1026669e8 node::worker::Worker::Run() [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
12: 0x102669c10 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/rosscoundon/.nvm/versions/node/v16.15.0/bin/node]
13: 0x1bb49c26c _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
14: 0x1bb49708c thread_start [/usr/lib/system/libsystem_pthread.dylib]
/var/folders/z6/5b6qwtvj7217ykrsmtcxckn40000gn/T/npx-603f6023.sh: line 1: 41684 Abort trap: 6           vitest run -t 'Marketing handler campaign requests' src/test/unit/handler/marketing/marketingHandler.test.ts

If I run the test again after receiving this error, it will usually run without error on the 2nd or 3rd attempt

Node v16.15.0 Vitejs v3.0.0 Vitest v0.18.0

50/50 Getting these unhandled rejection errors both locally and on a WoodpeckerCI server even though my tests are shown to still pass.

✓ src/tests/links.test.tsx (2)
 ✓ src/tests/todos.test.tsx (2)
 ✓ src/tests/nav.test.tsx (1)
 ✓ src/tests/footer.test.tsx (2)

Test Files  4 passed (4)
     Tests  7 passed (7)
      Time  3.44s (in thread 65ms, 5297.18%)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: 
 ❯ post node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/worker.mjs:70:14
 ❯ node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-vite-node-utils.af8ead96.mjs:9149:11
 ❯ sendCall node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-vite-node-utils.af8ead96.mjs:9146:16
 ❯ node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-runtime-rpc.cc6a06a2.mjs:7:55
      5|   return new Proxy(rpc2, {
      6|     get(target, p, handler) {
      7|       const sendCall = Reflect.get(target, p, handler);
       |                                                       ^
      8|       const safeSendCall = (...args) => withSafeTimers(() => sendCall(...args));
      9|       safeSendCall.asEvent = sendCall.asEvent;
 ❯ withSafeTimers node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-utils-global.1b22c4fd.mjs:472:20
 ❯ Proxy.safeSendCall node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/chunk-runtime-rpc.cc6a06a2.mjs:7:41
 ❯ process.<anonymous> node_modules/.pnpm/vitest@0.18.0_happy-dom@6.0.3/node_modules/vitest/dist/worker.mjs:34:11
 ❯ process.emit node:events:527:28
 ❯ emit node:internal/process/promises:140:20
FATAL ERROR: v8::FromJust Maybe value is Nothing.
13s
94
1: 0xb0a860 node::Abort() [node]
13s
95
2: 0xa1c193 node::FatalError(char const*, char const*) [node]
13s
96
3: 0xcf97aa v8::Utils::ReportApiFailure(char const*, char const*) [node]
13s
97
4: 0xb0e6cd node::fs::FileHandle::CloseReq::Resolve() [node]
13s
98
5: 0xb0e829 [node]
13s
99
6: 0x1560e0d [node]
13s
100
7: 0x15655e6 [node]
13s
101
8: 0x1577d14 [node]
13s
102
9: 0x1565f38 uv_run [node]
13s
103
10: 0xa43dd5 node::SpinEventLoop(node::Environment*) [node]
13s
104
11: 0xbd43e2 node::worker::Worker::Run() [node]
13s
105
12: 0xbd4b78 [node]
13s
106
13: 0x7fdc80ad9fa3 [/lib/x86_64-linux-gnu/libpthread.so.0]
13s
107
14: 0x7fdc80a0aeff clone [/lib/x86_64-linux-gnu/libc.so.6]
13s
108
Aborted (core dumped) 

Seeing this occasionally also, sometimes appears once a test fails. Main issue this is causing my CI to not think the test failed and keeps on with the rest of the stages.