Report a bug
🔎 Search Terms
"Scope already named Array already exists", "attest parse error Array", "arktype attest conflict", "pnpm dual-package hazard @ark/schema"
🧩 Context
- ArkType version:
2.2.0
- TypeScript version (5.1+):
6.0.3
- Other context you think may be relevant (JS flavor, OS, etc.):
- Package Manager: pnpm@11.0.8 (workspaces enabled)
- OS: MacOS
- Runner: Vitest v4.1.5
🧑💻 Repro
This issue occurs when using @ark/attest@0.56.0 alongside arktype@2.2.0 in a pnpm workspace. The root cause is a dual-package hazard because @ark/attest has a hard dependency on arktype@2.1.28.
Reproduction Steps:
- Create a pnpm workspace.
- Add
arktype@2.2.0 and @ark/attest@0.56.0 to a package.
- Configure
vitest with globalSetup: ["@ark/attest/setup"].
- Run
vitest.
Expected Result:
Tests run successfully.
Actual Result:
The test runner fails during initialization with the following error:
ParseError: A Scope already named Array already exists
❯ throwError ../../node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/errors.js:5:11
❯ throwParseError ../../node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/errors.js:10:43
❯ new BaseScope ../../node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/scope.js:90:13
❯ new InternalScope ../../node_modules/.pnpm/arktype@2.2.0/node_modules/arktype/out/scope.js:10:8
❯ InternalScope.scope ../../node_modules/.pnpm/arktype@2.2.0/node_modules/arktype/out/scope.js:100:43
❯ InternalScope.module ../../node_modules/.pnpm/arktype@2.2.0/node_modules/arktype/out/scope.js:101:49
❯ ../../node_modules/.pnpm/arktype@2.2.0/node_modules/arktype/out/keywords/Array.js:14:31
Playground Link: https://arktype.io/playground (Note: This is a dependency resolution issue, so it may not be directly reproducible in the single-package browser playground).
// Repro involves multiple packages/resolutions
// But at a code level, simply importing both in the same environment triggers it:
import { type } from "arktype"
import { attest } from "@ark/attest"
// Error occurs during module evaluation of keywords/Array.js
// when the second copy of @ark/schema tries to register the 'Array' scope.
Proposed Solution
Update @ark/attest to use peerDependencies for arktype or ensure it is compatible with the latest major/minor releases to avoid duplicate internal @ark/* package registrations in hoisted environments.
Report a bug
🔎 Search Terms
"Scope already named Array already exists", "attest parse error Array", "arktype attest conflict", "pnpm dual-package hazard @ark/schema"
🧩 Context
2.2.06.0.3🧑💻 Repro
This issue occurs when using
@ark/attest@0.56.0alongsidearktype@2.2.0in a pnpm workspace. The root cause is a dual-package hazard because@ark/attesthas a hard dependency onarktype@2.1.28.Reproduction Steps:
arktype@2.2.0and@ark/attest@0.56.0to a package.vitestwithglobalSetup: ["@ark/attest/setup"].vitest.Expected Result:
Tests run successfully.
Actual Result:
The test runner fails during initialization with the following error:
Playground Link: https://arktype.io/playground (Note: This is a dependency resolution issue, so it may not be directly reproducible in the single-package browser playground).
Proposed Solution
Update
@ark/attestto usepeerDependenciesforarktypeor ensure it is compatible with the latest major/minor releases to avoid duplicate internal@ark/*package registrations in hoisted environments.