helloadhavan/github_issues huggingface dataset:
Repository: vercel/next.js
Pull request: Update Turbopack development test manifest

This auto-generated PR updates the development integration test manifest used when testing Turbopack.

Changed files:
filename: test/turbopack-dev-tests-manifest.json
patch: @@ -3410,7 +3410,9 @@
   },
   "test/development/experimental-https-server/https-server.generated-key.test.ts": {
     "passed": [
-      "experimental-https-server (generated certificate) only runs on CI as it requires administrator privileges"
+      "experimental-https-server (generated certificate) should successfully load the app in app dir",
+      "experimental-https-server (generated certificate) should successfully load the app in pages dir",
+      "experimental-https-server (generated certificate) should successfully reuse generated certificates"
     ],
     "failed": [],
     "pending": [],
@@ -7394,11 +7396,11 @@
     "runtimeError": false
   },
   "test/e2e/app-dir/next-image/next-image-https.test.ts": {
-    "passed": [
-      "app dir - next-image (with https) only runs on CI as it requires administrator privileges"
-    ],
+    "passed": [],
     "failed": [],
-    "pending": [],
+    "pending": [
+      "app dir - next-image (with https) loads images without any errors"
+    ],
     "flakey": [],
     "runtimeError": false
   },
@@ -8931,6 +8933,15 @@
     "flakey": [],
     "runtimeError": false
   },
+  "test/e2e/app-dir/segment-cache/deployment-skew/deployment-skew.test.ts": {
+    "passed": [
+      "segment cache (deployment skew) should not run during dev or deploy test runs"
+    ],
+    "failed": [],
+    "pending": [],
+    "flakey": [],
+    "runtimeError": false
+  },
   "test/e2e/app-dir/segment-cache/dynamic-on-hover/dynamic-on-hover.test.ts": {
     "passed": ["dynamic on hover prefetching is disabled"],
     "failed": [],
Repository: denoland/deno
Pull request: fix(ext/node): handle http2 server ending stream

Fixes #24845 

Creating standalone tests is difficult since from what I can make out this error is only manifested when talking to C++ grpc servers, but there is a full reproduction described [here](https://github.com/TobyEalden/deno-issue-24845). See also #26234.

Changed files:
filename: ext/node/ops/http2.rs
patch: @@ -488,13 +488,11 @@ pub async fn op_http2_client_get_response_body_chunk(
   loop {
     let result = poll_fn(|cx| poll_data_or_trailers(cx, &mut body)).await;
     if let Err(err) = result {
-      let reason = err.reason();
-      if let Some(reason) = reason {
-        if reason == Reason::CANCEL {
-          return Ok((None, false, true));
-        }
+      match err.reason() {
+        Some(Reason::NO_ERROR) => return Ok((None, true, false)),
+        Some(Reason::CANCEL) => return Ok((None, false, true)),
+        _ => return Err(err.into()),
       }
-      return Err(err.into());
     }
     match result.unwrap() {
       DataOrTrailers::Data(data) => {

filename: ext/node/polyfills/http2.ts
patch: @@ -882,6 +882,7 @@ export class ClientHttp2Stream extends Duplex {
       trailersReady: false,
       endAfterHeaders: false,
       shutdownWritableCalled: false,
+      serverEndedCall: false,
     };
     this[kDenoResponse] = undefined;
     this[kDenoRid] = undefined;
@@ -1109,7 +1110,9 @@ export class ClientHttp2Stream extends Duplex {
       }
 
       debugHttp2(">>> chunk", chunk, finished, this[kDenoResponse].bodyRid);
-      if (chunk === null) {
+      if (finished || chunk === null) {
+        this[kState].serverEndedCall = true;
+
         const trailerList = await op_http2_client_get_response_trailers(
           this[kDenoResponse].bodyRid,
         );
@@ -1237,7 +1240,9 @@ export class ClientHttp2Stream extends Duplex {
     this[kSession] = undefined;
 
     session[kMaybeDestroy]();
-    callback(err);
+    if (callback) {
+      callback(err);
+    }
   }
 
   [kMaybeDestroy](code = constants.NGHTTP2_NO_ERROR) {
@@ -1280,6 +1285,9 @@ function shutdownWritable(stream, callback, streamRid) {
   if (state.flags & STREAM_FLAGS_HAS_TRAILERS) {
     onStreamTrailers(stream);
     callback();
+  } else if (state.serverEndedCall) {
+    debugHttp2(">>> stream finished");
+    callback();
   } else {
     op_http2_client_send_data(streamRid, new Uint8Array(), true)
       .then(() => {
Repository: ggml-org/llama.cpp
Pull request: scripts: Fix remote option in Windows (#14102)

*Make sure to read the [contributing guidelines](https://github.com/ggml-org/llama.cpp/blob/master/CONTRIBUTING.md) before submitting a PR*


Changed files:
filename: convert_hf_to_gguf.py
patch: @@ -6389,8 +6389,8 @@ def parse_args() -> argparse.Namespace:
         help="model is executed on big endian machine",
     )
     parser.add_argument(
-        "model", type=Path,
-        help="directory containing model file",
+        "model", type=str,
+        help="directory containing model file or huggingface repository ID (if --remote)",
         nargs="?",
     )
     parser.add_argument(
@@ -6493,18 +6493,20 @@ def main() -> None:
     else:
         logging.basicConfig(level=logging.INFO)
 
-    dir_model = args.model
-
     if args.remote:
+        hf_repo_id = args.model
         from huggingface_hub import snapshot_download
         local_dir = snapshot_download(
-            repo_id=str(dir_model),
+            repo_id=hf_repo_id,
             allow_patterns=["LICENSE", "*.json", "*.md", "*.txt", "tokenizer.model"])
         dir_model = Path(local_dir)
         logger.info(f"Downloaded config and tokenizer to {local_dir}")
+    else:
+        hf_repo_id = None
+        dir_model = Path(args.model)
 
     if not dir_model.is_dir():
-        logger.error(f'Error: {args.model} is not a directory')
+        logger.error(f'Error: {dir_model} is not a directory')
         sys.exit(1)
 
     ftype_map: dict[str, gguf.LlamaFileType] = {
@@ -6524,9 +6526,9 @@ def main() -> None:
 
     if args.outfile is not None:
         fname_out = args.outfile
-    elif args.remote:
+    elif hf_repo_id:
         # if remote, use the model ID as the output file name
-        fname_out = Path("./" + str(args.model).replace("/", "-") + "-{ftype}.gguf")
+        fname_out = Path("./" + hf_repo_id.replace("/", "-") + "-{ftype}.gguf")
     else:
         fname_out = dir_model
 
@@ -6555,7 +6557,7 @@ def main() -> None:
                                      split_max_tensors=args.split_max_tensors,
                                      split_max_size=split_str_to_n_bytes(args.split_max_size), dry_run=args.dry_run,
                                      small_first_shard=args.no_tensor_first_split,
-                                     remote_hf_model_id=str(args.model) if args.remote else None)
+                                     remote_hf_model_id=hf_repo_id)
 
         if args.vocab_only:
             logger.info("Exporting model vocab...")
Repository: facebook/react
Pull request: [Float] add tests for resource emission when rendering no head or just a head

Added a couple tests to cover cases where resources are used when not rendering an entire document.

Changed files:
filename: packages/react-dom/src/__tests__/ReactDOMFloat-test.js
patch: @@ -248,6 +248,60 @@ describe('ReactDOMFloat', () => {
     );
   });
 
+  // @gate enableFloat
+  it('emits resources before everything else when rendering with no head', async () => {
+    function App() {
+      return (
+        <>
+          <title>foo</title>
+          <link rel="preload" href="foo" as="style" />
+        </>
+      );
+    }
+
+    await actIntoEmptyDocument(() => {
+      buffer = `<!DOCTYPE html><html><head>${ReactDOMFizzServer.renderToString(
+        <App />,
+      )}</head><body>foo</body></html>`;
+    });
+    expect(getVisibleChildren(document)).toEqual(
+      <html>
+        <head>
+          <link rel="preload" href="foo" as="style" />
+          <title>foo</title>
+        </head>
+        <body>foo</body>
+      </html>,
+    );
+  });
+
+  // @gate enableFloat
+  it('emits resources before everything else when rendering with just a head', async () => {
+    function App() {
+      return (
+        <head>
+          <title>foo</title>
+          <link rel="preload" href="foo" as="style" />
+        </head>
+      );
+    }
+
+    await actIntoEmptyDocument(() => {
+      buffer = `<!DOCTYPE html><html>${ReactDOMFizzServer.renderToString(
+        <App />,
+      )}<body>foo</body></html>`;
+    });
+    expect(getVisibleChildren(document)).toEqual(
+      <html>
+        <head>
+          <link rel="preload" href="foo" as="style" />
+          <title>foo</title>
+        </head>
+        <body>foo</body>
+      </html>,
+    );
+  });
+
   describe('HostResource', () => {
     // @gate enableFloat
     it('warns when you update props to an invalid type', async () => {
Repository: denoland/deno
Pull request: fix(add): create deno.json when running `deno add jsr:<pkg>`

Fixes https://github.com/denoland/deno/issues/26119.

Originally I wanted to put them in package.json if there's no deno.json, but on second thought it makes more sense to just create a deno.json

Changed files:
filename: cli/tools/registry/pm.rs
patch: @@ -400,14 +400,17 @@ impl std::fmt::Display for AddCommandName {
 
 fn load_configs(
   flags: &Arc<Flags>,
+  has_jsr_specifiers: impl FnOnce() -> bool,
 ) -> Result<(CliFactory, Option<NpmConfig>, Option<DenoConfig>), AnyError> {
   let cli_factory = CliFactory::from_flags(flags.clone());
   let options = cli_factory.cli_options()?;
   let npm_config = NpmConfig::from_options(options)?;
   let (cli_factory, deno_config) = match DenoConfig::from_options(options)? {
     Some(config) => (cli_factory, Some(config)),
-    None if npm_config.is_some() => (cli_factory, None),
-    None => {
+    None if npm_config.is_some() && !has_jsr_specifiers() => {
+      (cli_factory, None)
+    }
+    _ => {
       let factory = create_deno_json(flags, options)?;
       let options = factory.cli_options()?.clone();
       (
@@ -427,7 +430,9 @@ pub async fn add(
   add_flags: AddFlags,
   cmd_name: AddCommandName,
 ) -> Result<(), AnyError> {
-  let (cli_factory, npm_config, deno_config) = load_configs(&flags)?;
+  let (cli_factory, npm_config, deno_config) = load_configs(&flags, || {
+    add_flags.packages.iter().any(|s| s.starts_with("jsr:"))
+  })?;
   let mut npm_config = ConfigUpdater::maybe_new(npm_config).await?;
   let mut deno_config = ConfigUpdater::maybe_new(deno_config).await?;
 
@@ -764,7 +769,7 @@ pub async fn remove(
   flags: Arc<Flags>,
   remove_flags: RemoveFlags,
 ) -> Result<(), AnyError> {
-  let (_, npm_config, deno_config) = load_configs(&flags)?;
+  let (_, npm_config, deno_config) = load_configs(&flags, || false)?;
 
   let mut configs = [
     ConfigUpdater::maybe_new(npm_config).await?,

filename: tests/specs/add/jsr_prefers_deno_json/__test__.jsonc
patch: @@ -0,0 +1,16 @@
+{
+  "tempDir": true,
+  "steps": [
+    {
+      "args": "add jsr:@denotest/add",
+      "output": "add.out"
+    },
+    {
+      "args": [
+        "eval",
+        "console.log(Deno.readTextFileSync('./deno.json').trim())"
+      ],
+      "output": "deno.json.out"
+    }
+  ]
+}

filename: tests/specs/add/jsr_prefers_deno_json/add.out
patch: @@ -0,0 +1,3 @@
+Created deno.json configuration file.
+Add jsr:@denotest/add@1.0.0
+Download [WILDCARD]

filename: tests/specs/add/jsr_prefers_deno_json/deno.json.out
patch: @@ -0,0 +1,5 @@
+{
+  "imports": {
+    "@denotest/add": "jsr:@denotest/add@^1.0.0"
+  }
+}

filename: tests/specs/add/jsr_prefers_deno_json/package.json
patch: @@ -0,0 +1 @@
+{}
Repository: huggingface/transformers
Pull request: Fix broken example generation script for Llama3

# What does this PR do?

Running this script with Llama3 fails with error:
```
...
--> 316     return _sentencepiece.SentencePieceProcessor_LoadFromFile(self, arg)
TypeError: not a string
```

As mentioned in #30607 this is because Llama3 tokenizer is not based on sentencepiece. The fix is to use `AutoTokenizer` which will use `PreTrainedTokenizerFast` for Llama3.

Changed files:
filename: examples/pytorch/text-generation/run_generation.py
patch: @@ -34,7 +34,6 @@
     GPT2Tokenizer,
     GPTJForCausalLM,
     LlamaForCausalLM,
-    LlamaTokenizer,
     OpenAIGPTLMHeadModel,
     OpenAIGPTTokenizer,
     OPTForCausalLM,
@@ -63,7 +62,7 @@
     "xlm": (XLMWithLMHeadModel, XLMTokenizer),
     "gptj": (GPTJForCausalLM, AutoTokenizer),
     "bloom": (BloomForCausalLM, BloomTokenizerFast),
-    "llama": (LlamaForCausalLM, LlamaTokenizer),
+    "llama": (LlamaForCausalLM, AutoTokenizer),
     "opt": (OPTForCausalLM, GPT2Tokenizer),
 }
Repository: denoland/deno
Pull request: fix: panic in `prepare_stack_trace_callback` when global interceptor throws

Fixes https://github.com/denoland/deno/issues/26240
Fixes https://github.com/denoland/deno/pull/24985#issuecomment-2365460210

Fix panic when a global interceptor is misconfigured or throws an exception. 

Updates deno_core to 0.313.0

Changed files:
filename: Cargo.lock
patch: @@ -1422,9 +1422,9 @@ dependencies = [
 
 [[package]]
 name = "deno_core"
-version = "0.312.0"
+version = "0.313.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed5b20008c84715322782af2f94ff7ebc34eb50294ae098daf36b63a5b9bdd24"
+checksum = "29f36be738d78e39b6603a6b07f1cf91e28baf3681f87205f07482999e0d0bc2"
 dependencies = [
  "anyhow",
  "bincode",
@@ -1922,9 +1922,9 @@ dependencies = [
 
 [[package]]
 name = "deno_ops"
-version = "0.188.0"
+version = "0.189.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba1c7a8d9169e23de729000d6903dd0dee39e521e226d1ffbb9c5336665afae6"
+checksum = "e8f998ad1d5b36064109367ffe67b1088385eb3d8025efc95e445bc013a147a2"
 dependencies = [
  "proc-macro-rules",
  "proc-macro2",
@@ -6175,9 +6175,9 @@ dependencies = [
 
 [[package]]
 name = "serde_v8"
-version = "0.221.0"
+version = "0.222.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ca142cf34468e22063560302e6cc5e45f48e95a0dd25b3e22d6c32c32251135"
+checksum = "27130b5cd87f6f06228940a1f3a7ecc988ea13d1bede1398a48d74cb59dabc9a"
 dependencies = [
  "num-bigint",
  "serde",

filename: Cargo.toml
patch: @@ -46,7 +46,7 @@ repository = "https://github.com/denoland/deno"
 
 [workspace.dependencies]
 deno_ast = { version = "=0.42.2", features = ["transpiling"] }
-deno_core = { version = "0.312.0" }
+deno_core = { version = "0.313.0" }
 
 deno_bench_util = { version = "0.165.0", path = "./bench_util" }
 deno_lockfile = "=0.23.1"
Repository: vercel/next.js
Pull request: [release] couple `next` and `@next/swc` versions

### Why?

Since Next.js emits a debug warning to help catch when a stale `@next/swc` version is being used, couple their versions to be published together.

https://github.com/vercel/next.js/blob/3f2a3647ee619c92f2d576b83dfde748003a7f31/packages/next/src/build/swc/index.ts#L131-L139


Changed files:
filename: .changeset/config.json
patch: @@ -2,7 +2,7 @@
   "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
   "changelog": "@changesets/cli/changelog",
   "commit": false,
-  "fixed": [],
+  "fixed": [["next", "@next/swc"]],
   "linked": [],
   "access": "public",
   "baseBranch": "canary",

filename: scripts/publish-native.js
patch: @@ -11,9 +11,7 @@ const cwd = process.cwd()
   try {
     const publishSema = new Sema(2)
 
-    let version = JSON.parse(
-      await readFile(path.join(cwd, 'lerna.json'))
-    ).version
+    let version = require('@next/swc/package.json').version
 
     // Copy binaries to package folders, update version, and publish
     let nativePackagesDir = path.join(cwd, 'crates/napi/npm')
Repository: electron/electron
Pull request: test: run visibility-state-spec.ts first

#### Description of Change
I realized looking at the backports of #44037 that it did not actually run the visibility tests first.  The backports have been corrected before merging, but this fix is needed for main.
<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.

Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md
-->

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/main/README.md#examples -->none


Changed files:
filename: script/split-tests.js
patch: @@ -3,8 +3,6 @@ const glob = require('glob');
 const fs = require('node:fs');
 const path = require('node:path');
 
-const VISIBILITY_SPEC = 'spec\\visibility-state-spec.ts';
-
 const currentShard = parseInt(process.argv[2], 10);
 const shardCount = parseInt(process.argv[3], 10);
 
@@ -33,11 +31,4 @@ for (const specFile of specFiles) {
   if (shard === shardCount) shard = 0;
 }
 
-const visiblitySpecIdx = buckets[currentShard - 1];
-if (visiblitySpecIdx > -1) {
-  // If visibility-state-spec is in the list, move it to the first position
-  // so that it gets executed first to avoid other specs interferring with it.
-  buckets[currentShard - 1].splice(visiblitySpecIdx, 1);
-  buckets[currentShard - 1].unshift(VISIBILITY_SPEC);
-}
 console.log(buckets[currentShard - 1].join(' '));

filename: spec/index.js
patch: @@ -149,7 +149,17 @@ app.whenReady().then(async () => {
 
   const { getFiles } = require('./get-files');
   const testFiles = await getFiles(__dirname, filter);
-  for (const file of testFiles.sort()) {
+  const VISIBILITY_SPEC = ('visibility-state-spec.ts');
+  const sortedFiles = testFiles.sort((a, b) => {
+    // If visibility-state-spec is in the list, move it to the first position
+    // so that it gets executed first to avoid other specs interferring with it.
+    if (a.indexOf(VISIBILITY_SPEC) > -1) {
+      return -1;
+    } else {
+      return a.localeCompare(b);
+    }
+  });
+  for (const file of sortedFiles) {
     mocha.addFile(file);
   }
Repository: ggml-org/llama.cpp
Pull request: ggml-cpu: fix uncaught underscore terminators for s390x

This pull request fixes unterminated underscores with `__attribute__` in the s390x codebase.

### Verification
To ensure that this patch did not break anything, the patch has been tested on the following models:
1. Tested IBM Granite 3.1 (F16)

> [!NOTE]
> Tests were conducted on an IBM z15 Mainframe with 16 IFLs (cores) and 160 GB Memory on an LPAR.

Changed files:
filename: ggml/src/ggml-cpu/ggml-cpu-impl.h
patch: @@ -371,7 +371,7 @@ inline static int32x4_t ggml_vdotq_s32(int32x4_t acc, int8x16_t a, int8x16_t b)
 #define vec_xor(a, b) ((a) ^ (b)) // Vector XOR
 #endif
 
-typedef signed char char8x16_t __attribute__((vector_size(16)));
+typedef signed   char char8x16_t  __attribute__((vector_size(16)));
 typedef unsigned char uchar8x16_t __attribute__((vector_size(16)));
 
 typedef int8_t  int8x16_t __attribute__((vector_size(16)));
@@ -382,10 +382,10 @@ typedef uint8_t  uint8x16_t __attribute__((vector_size(16)));
 typedef uint16_t uint16x8_t __attribute__((vector_size(16)));
 typedef uint32_t uint32x4_t __attribute__((vector_size(16)));
 
-typedef float float32x4_t __attribute__((vector_size(16)));
-typedef double double64x2_t __attribute((vector_size(16)));
+typedef float  float32x4_t  __attribute__((vector_size(16)));
+typedef double double64x2_t __attribute__((vector_size(16)));
 
-typedef signed long long long64x2_t __attribute((vector_size(16)));
+typedef signed   long long long64x2_t  __attribute__((vector_size(16)));
 typedef unsigned long long ulong64x2_t __attribute__((vector_size(16)));
 
 typedef struct ggml_uint8x16x2_t {
Repository: nodejs/node
Pull request: doc: update websocket link to avoid linking to self

The link `WebSocket` is pointing to the section itself.

https://github.com/nodejs/node/blob/793c7936c394aba54875f84b135684e38a30ff94/doc/api/http.md?plain=1#L4241


Changed files:
filename: doc/api/http.md
patch: @@ -4256,7 +4256,7 @@ A browser-compatible implementation of [`WebSocket`][].
 [`Headers`]: globals.md#class-headers
 [`TypeError`]: errors.md#class-typeerror
 [`URL`]: url.md#the-whatwg-url-api
-[`WebSocket`]: #websocket
+[`WebSocket`]: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
 [`agent.createConnection()`]: #agentcreateconnectionoptions-callback
 [`agent.getName()`]: #agentgetnameoptions
 [`destroy()`]: #agentdestroy
Repository: ggml-org/llama.cpp
Pull request: ggml: Add Apple support for GGML_CPU_ALL_VARIANTS


Changed files:
filename: ggml/src/CMakeLists.txt
patch: @@ -330,6 +330,10 @@ if (GGML_CPU_ALL_VARIANTS)
             ggml_add_cpu_backend_variant(android_armv8.2_1    DOTPROD)
             ggml_add_cpu_backend_variant(android_armv8.2_2    DOTPROD FP16_VECTOR_ARITHMETIC)
             ggml_add_cpu_backend_variant(android_armv8.6_1    DOTPROD FP16_VECTOR_ARITHMETIC MATMUL_INT8)
+        elseif (APPLE)
+            ggml_add_cpu_backend_variant(apple_m1             DOTPROD)
+            ggml_add_cpu_backend_variant(apple_m2_m3          DOTPROD MATMUL_INT8)
+            ggml_add_cpu_backend_variant(apple_m4             DOTPROD MATMUL_INT8 NOSVE SME)
         else()
             message(FATAL_ERROR "Unsupported ARM target OS: ${CMAKE_SYSTEM_NAME}")
         endif()

filename: ggml/src/ggml-cpu/CMakeLists.txt
patch: @@ -190,6 +190,9 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
                         set(ARCH_TAGS "${ARCH_TAGS}+sve2")
                         list(APPEND ARCH_DEFINITIONS GGML_USE_SVE2)
                     endif()
+                    if (GGML_INTERNAL_NOSVE)
+                        set(ARCH_TAGS "${ARCH_TAGS}+nosve")
+                    endif()
                     if (GGML_INTERNAL_SME)
                         set(ARM_MCPU "armv9.2-a")
                         set(ARCH_TAGS "${ARCH_TAGS}+sme")
Repository: nodejs/node
Pull request: [v22.x backport] typescript syntax detection

Backport of some PRs:
- https://github.com/nodejs/node/pull/56285
- https://github.com/nodejs/node/pull/56358
- https://github.com/nodejs/node/pull/56359
- https://github.com/nodejs/node/pull/56394
- https://github.com/nodejs/node/pull/56610
- https://github.com/nodejs/node/pull/56646

As requested @aduh95 

Changed files:
filename: lib/internal/modules/typescript.js
patch: @@ -1,5 +1,8 @@
 'use strict';
 
+const {
+  ObjectPrototypeHasOwnProperty,
+} = primordials;
 const {
   validateBoolean,
   validateOneOf,
@@ -12,7 +15,6 @@ const { assertTypeScript,
         isUnderNodeModules,
         kEmptyObject } = require('internal/util');
 const {
-  ERR_INTERNAL_ASSERTION,
   ERR_INVALID_TYPESCRIPT_SYNTAX,
   ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING,
   ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX,
@@ -55,15 +57,16 @@ function parseTypeScript(source, options) {
      * Amaro v0.3.0 (from SWC v1.10.7) throws an object with `message` and `code` properties.
      * It allows us to distinguish between invalid syntax and unsupported syntax.
      */
-    switch (error.code) {
+    switch (error?.code) {
       case 'UnsupportedSyntax':
         throw new ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX(error.message);
       case 'InvalidSyntax':
         throw new ERR_INVALID_TYPESCRIPT_SYNTAX(error.message);
       default:
-        // SWC will throw strings when something goes wrong.
-        // Check if has the `message` property or treat it as a string.
-        throw new ERR_INTERNAL_ASSERTION(error.message ?? error);
+        // SWC may throw strings when something goes wrong.
+        if (typeof error === 'string') { assert.fail(error); }
+        assert(error != null && ObjectPrototypeHasOwnProperty(error, 'message'));
+        assert.fail(error.message);
     }
   }
 }