[GH-ISSUE #1418] docs: Quickstart example throws multiple errors #203

Open
opened 2026-02-17 17:19:23 -05:00 by yindo · 1 comment
Owner

Originally created by @gonzochic on GitHub (Nov 13, 2025).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/1418

Checklist

  • I added a very descriptive title to this issue.
  • I included a link to the documentation page I am referring to (if applicable).

Issue with current documentation:

I tried to follow the Quickstart examples for Typescript. Do only adaption I did, i used gpt-4o instead of the Sonnet models (altough I don't think this is the issues)

Multiple issues occured:

  1. Typescript error: The "getUserLocation" Tool code creates a typescript error.
    Image

  2. When running the full example code, it fails with a ``ìnvalid_request_error```.
    Image

error: 400 Invalid schema for response_format 'extract': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'weather_conditions'.

I am using:

  • Bun v1.3
  • langchain v1.0.4
  • @langchain/core v1.0.4
  • @langchain/openai v1.1.0
  • MacOS 15.6.1

Idea or request for content:

No response

Originally created by @gonzochic on GitHub (Nov 13, 2025). Original GitHub issue: https://github.com/langchain-ai/docs/issues/1418 ### Checklist - [x] I added a very descriptive title to this issue. - [x] I included a link to the documentation page I am referring to (if applicable). ### Issue with current documentation: I tried to follow the [Quickstart examples for Typescript](https://docs.langchain.com/oss/javascript/langchain/quickstart#example-using-json-schema-for-tool-input). Do only adaption I did, i used gpt-4o instead of the Sonnet models (altough I don't think this is the issues) Multiple issues occured: 1. Typescript error: The "getUserLocation" Tool code creates a typescript error. <img width="1010" height="308" alt="Image" src="https://github.com/user-attachments/assets/e5196ff8-8ade-4371-8f21-e9b007010e78" /> 2. When running the full example code, it fails with a ``ìnvalid_request_error```. <img width="736" height="273" alt="Image" src="https://github.com/user-attachments/assets/a980ed41-fcf2-422b-9c8d-df3ce744e8cc" /> ```error: 400 Invalid schema for response_format 'extract': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'weather_conditions'.``` I am using: - Bun v1.3 - langchain v1.0.4 - @langchain/core v1.0.4 - @langchain/openai v1.1.0 - MacOS 15.6.1 ### Idea or request for content: _No response_
yindo added the external label 2026-02-17 17:19:23 -05:00
Author
Owner

@MilanMeurrens commented on GitHub (Nov 19, 2025):

It seems like this is an OpenAI specific problem. Anthropic handles the optional fields in the scheme Zod generates better.

What you can do to make it work with OpenAi is use a union with the type and null instead of using optional.

name: z.union([z.string(), z.null()])

Edit: I just discovered using nullable also works: name: z.nullable(z.string())

@MilanMeurrens commented on GitHub (Nov 19, 2025): It seems like this is an OpenAI specific problem. Anthropic handles the optional fields in the scheme Zod generates better. What you can do to make it work with OpenAi is use a union with the type and null instead of using optional. `name: z.union([z.string(), z.null()])` Edit: I just discovered using nullable also works: `name: z.nullable(z.string())`
yindo changed title from docs: Quickstart example throws multiple errors to [GH-ISSUE #1418] docs: Quickstart example throws multiple errors 2026-06-05 17:25:37 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#203