Bug in LangGraph API server for graphs in relative paths. #155

Closed
opened 2026-02-15 17:16:31 -05:00 by yindo · 3 comments
Owner

Originally created by @tjrivera on GitHub (Jan 4, 2025).

Hi folks,

Not sure where the best place to put this is as I can't find the actual code for the LangGraph API server/LangGraph Studio and figure its not on GitHub

Issue:

I have a graph defined within a monorepo and have my langgraph.json file in the root of my repository. My langgraph configuration looks like:

{
  "node_version": "20",
  "dockerfile_lines": [],
  "dependencies": ["./packages/agents", "./packages/core"],
  "graphs": {
    "agent": "./packages/agents/src/test/graph.ts:graph"
  },
  "env": "packages/agents/.env"
}

I found that I can get the graph to build and load into studio, but that my Input form was not rendering properly -- I could only enter raw input i.e. { messages: [{...}]} instead of the nice form with the ability to select Human, AI, System, etc.

Bad build:
Screenshot 2025-01-04 at 6 34 57 PM
Expected build:
Screenshot 2025-01-04 at 6 36 30 PM

Checking my logs I found warnings of:

langgraph-api-1       | Failed to obtain symbol "__langgraph__graph__input": Unsupported type: 0 extends 1 & ValueType ? ValueType | undefined : Wrap<MatchBaseMessageArray<ValueType>> extends Wrap<...> ? import("/Users/tyler/code/test/node_modules/@langchain/core/dist/messages/base").BaseMessage[] : Wrap<...> extends Wrap<...> ? import("/Users/tyler/code/plum-fit-web/node_modules/@langchain/core/dist/messages/base").BaseMess...
langgraph-api-1       | Failed to obtain symbol "__langgraph__graph__input": Unsupported type: 0 extends 1 & ValueType ? ValueType | undefined : Wrap<MatchBaseMessageArray<ValueType>> extends Wrap<...> ? import("/Users/tyler/code/plum-fit-web/node_modules/@langchain/core/dist/messages/base").BaseMessage[] : Wrap<...> extends Wrap<...> ? import("/Users/tyler/code/test/node_modules/@langchain/core/dist/messages/base").BaseMess...

I tracked this down to the /api/langgraph_api/js/src/parser/parser.mts in the API server container:

    host.compilerHost.resolveModuleNames = (moduleNames, containingFile) => {
      const resolvedModules: (ts.ResolvedModule | undefined)[] = [];
      for (const moduleName of moduleNames) {
        let target = containingFile;
        const relative = path.relative(dirname, containingFile);
        if (
          moduleName.startsWith("@langchain/langgraph") &&
          relative &&
          !relative.startsWith("..") &&
          !path.isAbsolute(relative)
        ) {
          target = path.resolve(__dirname, relative);
        }

        resolvedModules.push(
          ts.resolveModuleName(
            moduleName,
            target,
            compilerOptions,
            host.compilerHost
          ).resolvedModule
        );
      }

      return resolvedModules;
    };

and noticed that it is only taking into account the @langchain/langgraph package, whereas the BaseMessage types are in @langchain/core. Updating the conditional to:

        if (
          (
            moduleName.startsWith("@langchain/langgraph") || 
            moduleName.startsWith("@langchain/core")
          ) &&
          relative &&
          !relative.startsWith("..") &&
          !path.isAbsolute(relative)
        ) {
          target = path.resolve(__dirname, relative);
        }

seems to resolve the issue. My current workaround is creating a patch file:

--- parser.mts	2025-01-04 23:23:38.820551112 +0000
+++ parser.mts	2025-01-04 23:24:19.279845893 +0000
@@ -373,7 +373,7 @@
         let target = containingFile;
         const relative = path.relative(dirname, containingFile);
         if (
-          moduleName.startsWith("@langchain/langgraph") &&
+          (moduleName.startsWith("@langchain/langgraph") || moduleName.startsWith("@langchain/core")) &&
           relative &&
           !relative.startsWith("..") &&
           !path.isAbsolute(relative)

and including the patch in my dockerfile lines:

{
  "node_version": "20",
  "dockerfile_lines": [
    "COPY packages/agents/langgraph_api.patch /tmp/langgraph_api.patch",
    "RUN patch --forward -p0 /api/langgraph_api/js/src/parser/parser.mts < /tmp/langgraph_api.patch"
  ],
  "dependencies": ["./packages/agents", "./packages/core"],
  "graphs": {
    "agent": "./packages/agents/src/fitness/graph.ts:graph"
  },
  "env": "packages/agents/.env"
}

I'm happy to submit a patch for this, but if that's not possible, hope this report helps resolve on yourside. Thanks.

Originally created by @tjrivera on GitHub (Jan 4, 2025). Hi folks, Not sure where the best place to put this is as I can't find the actual code for the LangGraph API server/LangGraph Studio and figure its not on GitHub ## Issue: I have a graph defined within a monorepo and have my `langgraph.json` file in the root of my repository. My langgraph configuration looks like: ```json { "node_version": "20", "dockerfile_lines": [], "dependencies": ["./packages/agents", "./packages/core"], "graphs": { "agent": "./packages/agents/src/test/graph.ts:graph" }, "env": "packages/agents/.env" } ``` I found that I can get the graph to build and load into studio, but that my Input form was not rendering properly -- I could only enter raw input i.e. `{ messages: [{...}]}` instead of the nice form with the ability to select `Human`, `AI`, `System`, etc. Bad build: <img width="637" alt="Screenshot 2025-01-04 at 6 34 57 PM" src="https://github.com/user-attachments/assets/c096aa52-8b30-4f71-93e5-2fdb795f61ca" /> Expected build: <img width="638" alt="Screenshot 2025-01-04 at 6 36 30 PM" src="https://github.com/user-attachments/assets/9cf4171e-a4ef-4de6-870d-6bea0cc104ab" /> Checking my logs I found warnings of: ```bash langgraph-api-1 | Failed to obtain symbol "__langgraph__graph__input": Unsupported type: 0 extends 1 & ValueType ? ValueType | undefined : Wrap<MatchBaseMessageArray<ValueType>> extends Wrap<...> ? import("/Users/tyler/code/test/node_modules/@langchain/core/dist/messages/base").BaseMessage[] : Wrap<...> extends Wrap<...> ? import("/Users/tyler/code/plum-fit-web/node_modules/@langchain/core/dist/messages/base").BaseMess... langgraph-api-1 | Failed to obtain symbol "__langgraph__graph__input": Unsupported type: 0 extends 1 & ValueType ? ValueType | undefined : Wrap<MatchBaseMessageArray<ValueType>> extends Wrap<...> ? import("/Users/tyler/code/plum-fit-web/node_modules/@langchain/core/dist/messages/base").BaseMessage[] : Wrap<...> extends Wrap<...> ? import("/Users/tyler/code/test/node_modules/@langchain/core/dist/messages/base").BaseMess... ``` I tracked this down to the `/api/langgraph_api/js/src/parser/parser.mts` in the API server container: ```typescript host.compilerHost.resolveModuleNames = (moduleNames, containingFile) => { const resolvedModules: (ts.ResolvedModule | undefined)[] = []; for (const moduleName of moduleNames) { let target = containingFile; const relative = path.relative(dirname, containingFile); if ( moduleName.startsWith("@langchain/langgraph") && relative && !relative.startsWith("..") && !path.isAbsolute(relative) ) { target = path.resolve(__dirname, relative); } resolvedModules.push( ts.resolveModuleName( moduleName, target, compilerOptions, host.compilerHost ).resolvedModule ); } return resolvedModules; }; ``` and noticed that it is only taking into account the `@langchain/langgraph` package, whereas the `BaseMessage` types are in `@langchain/core`. Updating the conditional to: ```typescript if ( ( moduleName.startsWith("@langchain/langgraph") || moduleName.startsWith("@langchain/core") ) && relative && !relative.startsWith("..") && !path.isAbsolute(relative) ) { target = path.resolve(__dirname, relative); } ``` seems to resolve the issue. My current workaround is creating a patch file: ```patch --- parser.mts 2025-01-04 23:23:38.820551112 +0000 +++ parser.mts 2025-01-04 23:24:19.279845893 +0000 @@ -373,7 +373,7 @@ let target = containingFile; const relative = path.relative(dirname, containingFile); if ( - moduleName.startsWith("@langchain/langgraph") && + (moduleName.startsWith("@langchain/langgraph") || moduleName.startsWith("@langchain/core")) && relative && !relative.startsWith("..") && !path.isAbsolute(relative) ``` and including the patch in my dockerfile lines: ```json { "node_version": "20", "dockerfile_lines": [ "COPY packages/agents/langgraph_api.patch /tmp/langgraph_api.patch", "RUN patch --forward -p0 /api/langgraph_api/js/src/parser/parser.mts < /tmp/langgraph_api.patch" ], "dependencies": ["./packages/agents", "./packages/core"], "graphs": { "agent": "./packages/agents/src/fitness/graph.ts:graph" }, "env": "packages/agents/.env" } ``` I'm happy to submit a patch for this, but if that's not possible, hope this report helps resolve on yourside. Thanks.
yindo closed this issue 2026-02-15 17:16:31 -05:00
Author
Owner

@quinn-eschenbach commented on GitHub (Feb 17, 2025):

for people who have the same issue, i found this temporary work around:
you can change the input to raw and pass the message/s using this format: {"role":"human", "content":"hey"}

@quinn-eschenbach commented on GitHub (Feb 17, 2025): for people who have the same issue, i found this temporary work around: you can change the input to raw and pass the message/s using this format: `{"role":"human", "content":"hey"}`
Author
Owner

@dqbd commented on GitHub (May 30, 2025):

Hello! We've updated the logic for schema inference to be more resilient w.r.t. resolution of modules etc. Feel free to reopen the issue if the problem still persists.

@dqbd commented on GitHub (May 30, 2025): Hello! We've updated the logic for schema inference to be more resilient w.r.t. resolution of modules etc. Feel free to reopen the issue if the problem still persists.
Author
Owner

@ddewaele commented on GitHub (Jan 25, 2026):

It seems this issue is still popping up from time to time. Not sure if its the same root cause but the fact that the studio is not rendering properly is still an issue

Related issue : https://github.com/langchain-ai/langgraphjs/issues/1722

Currently having the same issue with the most simple agent setup on these latest versions at the time of writing

  "dependencies": {
    "@langchain/openai": "^1.2.3",
    "langchain": "^1.2.13",
    "langsmith": "^0.4.8"
  },
  "devDependencies": {
    "@langchain/langgraph-cli": "^1.1.11"
  }

Error

Failed to obtain symbol "__langgraph__agent_agent__input": Unsupported type: never

Worked fine with langchain 1.1.5

  "dependencies": {
    "@langchain/openai": "^1.2.3",
    "langchain": "1.1.5",
    "langsmith": "^0.4.8"
  },
  "devDependencies": {
    "@langchain/langgraph-cli": "^1.1.11"
  }
@ddewaele commented on GitHub (Jan 25, 2026): It seems this issue is still popping up from time to time. Not sure if its the same root cause but the fact that the studio is not rendering properly is still an issue Related issue : https://github.com/langchain-ai/langgraphjs/issues/1722 Currently having the same issue with the most simple agent setup on these latest versions at the time of writing ``` "dependencies": { "@langchain/openai": "^1.2.3", "langchain": "^1.2.13", "langsmith": "^0.4.8" }, "devDependencies": { "@langchain/langgraph-cli": "^1.1.11" } ``` Error ``` Failed to obtain symbol "__langgraph__agent_agent__input": Unsupported type: never ``` Worked fine with langchain 1.1.5 ``` "dependencies": { "@langchain/openai": "^1.2.3", "langchain": "1.1.5", "langsmith": "^0.4.8" }, "devDependencies": { "@langchain/langgraph-cli": "^1.1.11" } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#155