-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
Hey OpenAI team π
After updating to Zod v4 Iβm hitting this runtime error:
β [ERROR] No matching export in "node_modules/.pnpm/[email protected]/node_modules/zod/index.js" for import "ZodFirstPartyTypeKind"
node_modules/.pnpm/openai@5.8.3_ws@8.18.3_zod@4.0.2/node_modules/openai/_vendor/zod-to-json-schema/parsers/array.mjs:1:9:
1 β import { ZodFirstPartyTypeKind } from 'zod';
β΅ ~~~~~~~~~~~~~~~~~~~~~
Looks like the vendored zod-to-json-schema
in openai/helpers/zod
still expects the ZodFirstPartyTypeKind
export, which was removed in Zod v4.
Notes / ideas
- Pinning zod@3 is a temporary workaround, but it blocks upgrading the whole stack.
- A quick fix might be bumping the vendored zod-to-json-schema to a version that supports Zod v4 or swapping it out for the maintained
@asteasolutions/zod-to-openapi
which already handles the new internals.
Thanks for taking a look! Let me know if I can help with more info or a PR.
To Reproduce
- Fresh project with pnpm
- pnpm add [email protected] zod@^4
- Add a simple script:
import { zodResponseFormat } from 'openai/helpers/zod'
- pnpm tsx index.ts (or just bundle with esbuild) β error above.
Code snippets
OS
macOS
Node version
Node v22
Library version
Latest
GiovanniSlabs, alextbok, tday, barryShevlin, derekcicerone and 4 more