Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LangGraph JS SDK : errors are parsed as JSON #3416

Open
4 tasks done
arthberman opened this issue Feb 13, 2025 · 1 comment
Open
4 tasks done

LangGraph JS SDK : errors are parsed as JSON #3416

arthberman opened this issue Feb 13, 2025 · 1 comment

Comments

@arthberman
Copy link
Contributor

arthberman commented Feb 13, 2025

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

app.get("/test", async (c) => {
  const client = new Client({
    apiUrl: "http://localhost:2024",
  });
  const thread = await client.threads.get("non-existent-thread");
  return c.json({
    thread,
  });
});

Error Message and Stack Trace (if applicable)

[wrangler:inf] GET /test 500 Internal Server Error (39ms)
✘ [ERROR] SyntaxError: Unexpected token 'I', "Invalid th"... is not valid JSON

      at async Array.<anonymous>

Description

  • when the API return an error (forbidden, not found, ...), the SDK systematically parse it as JSON
  • error is not throw as it should be
  • we can't see the complete error

System Info

python -m langchain_core.sys_info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 24.2.0: Fri Dec 6 19:00:33 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8122
Python Version: 3.12.5 (main, Aug 14 2024, 04:32:18) [Clang 18.1.8 ]

Package Information

langchain_core: 0.3.34
langchain: 0.3.18
langchain_community: 0.3.17
langsmith: 0.3.8
langchain_anthropic: 0.3.7
langchain_aws: 0.2.12
langchain_openai: 0.3.5
langchain_text_splitters: 0.3.6
langgraph_api: 0.0.23
langgraph_cli: 0.1.71
langgraph_license: Installed. No version info available.
langgraph_sdk: 0.1.51
langgraph_storage: Installed. No version info available.

Optional packages not installed

langserve

Other Dependencies

aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
anthropic<1,>=0.45.0: Installed. No version info available.
async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
boto3: 1.36.18
click: 8.1.8
cryptography: 43.0.3
dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
httpx: 0.28.1
httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
jsonschema-rs: 0.25.1
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core<1.0.0,>=0.3.34: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-text-splitters<1.0.0,>=0.3.6: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain<1.0.0,>=0.3.18: Installed. No version info available.
langgraph: 0.2.71
langgraph-checkpoint: 2.0.12
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
langsmith<0.4,>=0.1.17: Installed. No version info available.
numpy: 2.2.2
numpy<2,>=1.26.4;: Installed. No version info available.
numpy<3,>=1.26.2;: Installed. No version info available.
openai<2.0.0,>=1.58.1: Installed. No version info available.
orjson: 3.10.15
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.10.6
pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pyjwt: 2.10.1
pytest: Installed. No version info available.
python-dotenv: 1.0.1
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.3
requests-toolbelt: 1.0.0
requests<3,>=2: Installed. No version info available.
rich: Installed. No version info available.
SQLAlchemy<3,>=1.4: Installed. No version info available.
sse-starlette: 2.1.3
starlette: 0.45.3
structlog: 24.4.0
tenacity: 9.0.0
tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken<1,>=0.7: Installed. No version info available.
typing-extensions>=4.7: Installed. No version info available.
uvicorn: 0.34.0
watchfiles: 1.0.4
zstandard: 0.23.0

@dqbd
Copy link
Contributor

dqbd commented Feb 13, 2025

Hello! Thank you for reporting, taking a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants