Skip to content

LangGraph Integration: TypeError: Cannot read properties of null (reading 'messages') #19353

@jadengis

Description

@jadengis

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

10.38

Framework Version

No response

Link to Sentry event

https://underflow.sentry.io/issues/7260163588/?project=4510575266824192&query=is%3Aunresolved&referrer=issue-stream

Reproduction Example/SDK Setup

The LangGraph docs ask you to pass null as the first argument to graph.invoke when resuming the graph from a checkpoint. See here: https://docs.langchain.com/oss/javascript/langgraph/use-functional-api#resuming-after-an-error

await main.invoke(null, config);

However, @sentry/core incorrectly assumes that arg[0] is not-null, see here: https://github.com/getsentry/sentry-javascript/blob/develop/packages/core/src/tracing/langgraph/index.ts#L138.

            // Parse input messages
            const recordInputs = options.recordInputs;
            const recordOutputs = options.recordOutputs;
            const inputMessages =
              args.length > 0 ? ((args[0] as { messages?: LangChainMessage[] }).messages ?? []) : [];

This causes an error for resume on error, breaking the langgraph resume functionality, or force me to disable the langgraph API.

Steps to Reproduce

Attempt to resume a langgraph according to the docs main.invoke(null, config) with Sentry auto-instrumentation enabled.

Expected Result

No error on resume.

Actual Result

And error occurs.

Additional Context

No response

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions