zod 4 toJSONSchema() throws a deferred SC2011 in finalize (Map entries spread)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- compilers
Hướng nghiên cứu
Start by reproducing with the minimal index.ts (a z.object calling toJSONSchema()) and the scriptc build command from the issue, then read the failing line 295 of node_modules/zod/v4/core/to-json-schema.js, which spreads ctx.seen.entries() in finalize. The payload does not name the compiler source that emits SC2011, so the first step is locating where that diagnostic is raised for untyped Map entries. Done means the probe prints the expected draft 2020-12 JSON Schema without the SC2011 error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
toJSONSchema() from zod 4.4.3 compiles, but throws at run time with a deferred SC2011 inside zod's finalize.
index.ts:
import { z } from "zod";
console.log(JSON.stringify(z.object({ a: z.string() }).toJSONSchema()));
With [email protected] installed and a tsconfig.json of {"compilerOptions":{"target":"ES2022","module":"NodeNext","moduleResolution":"NodeNext","strict":true}}, scriptc build index.ts -o probe --optimization dev --node-islands=off builds (0.4.10 and 0.4.11). Running ./probe:
scriptc: not compiled: values of type 'any' have no native representation at this site (instantiating 'finalize' with ({ counter: number; cycles: unknown; external: unknown; io: unknown; metadataR...)) [SC2011 at node_modules/zod/v4/core/to-json-schema.js:295]
Uncaught Error: values of type 'any' have no native representation at this site (instantiating 'finalize' with ...) [SC2011 at node_modules/zod/v4/core/to-json-schema.js:295]
at finalize (node_modules/zod/v4/core/to-json-schema.js:295:5)
Node prints {"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"a":{"type":"string"}},"required":["a"],"additionalProperties":false}.
Line 295 of to-json-schema.js is
for (const entry of [...ctx.seen.entries()].reverse()) {
where ctx.seen is a Map built in initializeContext (seen: new Map()), keyed by schema with untyped entry objects. The same happens through schema["~standard"].jsonSchema.input(...) and z.toJSONSchema(schema), which all reach finalize.
Programs that hand zod schemas to the MCP SDK (tool listings) or build structured-output prompts with z.toJSONSchema hit this.
- Ngôn ngữ chính
- TypeScript
- Star
- 6.6k
- Fork
- 216
- Merge trung bình
- 9 giờ 35 phút
- Pull request đã merge (30 ngày)
- 775
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của vercel-labs/scriptc
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vercel-labs/scriptc#3979 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support undici 8.x request() through the built-in implementationCó thể đã có người làm @younggglcy đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
vercel-labs/scriptc#3894 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A native program crashes with SIGSEGV when a string or JSON builder grows past 4 MiBCó thể đã có người làm @alantriesagain đã nhận 5 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 22/100
vercel-labs/scriptc#3642 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
vercel-labs/scriptc#3613 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Native CLI (scriptc.exe) segfaults on a large program that the same release compiles under NodeĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
vercel-labs/scriptc#3595 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của vercel-labs/scriptc
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
milind-soni/OpenMausBot#6730 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Đang mởarea: @angular/build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
angular/angular-cli#34764 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status/need-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
google-gemini/gemini-cli#30384 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
P2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:image documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày