CopilotKit: 🐛 Bug: some times chat with CopilotKit fail to fetch from coAgent (python SDK)

♻️ Reproduction Steps

  1. Configure CopilotKit witt NextJS and LangGraph (coAgents) on python SDK and FastApi;
  2. Configure a LangGraph React agent with tools;
  3. Send many messages in many chats at same time, many times;
  4. It happens more easily when FastApi is running in the Docker container;

✅ Expected Behavior

Many chats (threads) at same time occurring normally and without problems.

❌ Actual Behavior

Image

Image

I’m chatting normally with CopilotKit and for some reason I don’t understand why I start to experience NETWORK errors, and if I start a new chat the problem stops.

𝌚 CopilotKit Version

Front:
    "@copilotkit/react-core": "1.5.13",
    "@copilotkit/react-ui": "1.5.13",
    "@copilotkit/runtime": "1.5.13",
    "next": "15.1.2",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
    Node: 20.16.0

Backend: 
    copilotkit==0.1.34
    Python: 3.12.3

📄 Logs (Optional)

NEXTJS:
Error getting response: [CopilotKitLowLevelError: Failed to fetch from url http://localhost:8000/relatorio/analytics/ia/copilotkit/agents/execute.

Possible reasons:
- -The server might be down or unreachable
- -There might be a network issue (e.g., DNS failure, connection timeout)
- -The URL might be incorrect
- -The server is not running on the specified port

See more: [https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found](https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found)] {
  path: undefined,
  locations: undefined,
  extensions: [Object],
  code: 'NETWORK_ERROR',
  statusCode: 503
}
[15:36:48.426] ERROR: Failed to fetch from url http://localhost:8000/relatorio/analytics/ia/copilotkit/agents/execute.

Possible reasons:
- -The server might be down or unreachable
- -There might be a network issue (e.g., DNS failure, connection timeout)
- -The URL might be incorrect
- -The server is not running on the specified port

See more: [https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found](https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found)
    component: "Yoga GraphQL"
    err: {
      "type": "GraphQLError",
      "message": "Failed to fetch from url http://localhost:8000/relatorio/analytics/ia/copilotkit/agents/execute.\n\nPossible reasons:\n- -The server might be down or unreachable\n- -There might be a network issue (e.g., DNS failure, connection timeout) \n- -The URL might be incorrect\n- -The server is not running on the specified port\n\nSee more: [https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found](https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found)",
      "stack":
          CopilotKitLowLevelError: Failed to fetch from url http://localhost:8000/relatorio/analytics/ia/copilotkit/agents/execute.

          Possible reasons:
          - -The server might be down or unreachable
          - -There might be a network issue (e.g., DNS failure, connection timeout)
          - -The URL might be incorrect
          - -The server is not running on the specified port

          See more: [https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found](https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found)
              at new CopilotKitError (webpack-internal:///(rsc)/./node_modules/@copilotkit/shared/dist/index.js:115:5)
              at new CopilotKitLowLevelError (webpack-internal:///(rsc)/./node_modules/@copilotkit/shared/dist/index.js:203:5)
              at Object.langGraphAgentHandler (webpack-internal:///(rsc)/./node_modules/@copilotkit/runtime/dist/index.js:2503:15)
              at async CopilotRuntime.processAgentRequest (webpack-internal:///(rsc)/./node_modules/@copilotkit/runtime/dist/index.js:3451:22)
              at async CopilotRuntime.processRuntimeRequest (webpack-internal:///(rsc)/./node_modules/@copilotkit/runtime/dist/index.js:3232:16)
              at async CopilotResolver.generateCopilotResponse (webpack-internal:///(rsc)/./node_modules/@copilotkit/runtime/dist/index.js:4933:138)
              at async eval (webpack-internal:///(rsc)/./node_modules/@envelop/core/cjs/orchestrator.js:389:27)
              at async YogaServer.getResultForParams (webpack-internal:///(rsc)/./node_modules/graphql-yoga/cjs/server.js:287:26)
              at async handle (webpack-internal:///(rsc)/./node_modules/graphql-yoga/cjs/server.js:365:25)
              at async AppRouteRouteModule.do (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:10:32804)
              at async AppRouteRouteModule.handle (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:10:39698)
              at async doRender (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:1452:42)
              at async responseGenerator (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:1813:28)
              at async DevServer.renderToResponseWithComponentsImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:1823:28)
              at async DevServer.renderPageComponent (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:2250:24)
              at async DevServer.renderToResponseImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:2288:32)
              at async DevServer.pipeImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:959:25)
              at async NextNodeServer.handleCatchallRenderRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\next-server.js:281:17)
              at async DevServer.handleRequestImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:853:17)
              at async C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:371:20
              at async Span.traceAsyncFn (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\trace\trace.js:153:20)
              at async DevServer.handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:368:24)
              at async invokeRender (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:230:21)
              at async responseGenerator (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:1813:28)
              at async DevServer.renderToResponseWithComponentsImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:1823:28)
              at async DevServer.renderPageComponent (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:2250:24)
              at async DevServer.renderToResponseImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:2288:32)
              at async DevServer.pipeImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:959:25)
              at async NextNodeServer.handleCatchallRenderRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\next-server.js:281:17)
              at async DevServer.handleRequestImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:853:17)
              at async C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:371:20
              at async Span.traceAsyncFn (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\trace\trace.js:153:20)
              at async DevServer.handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:368:24)
              at async invokeRender (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:230:21)
              at async handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:408:24)
              at async DevServer.renderToResponseImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:2288:32)
              at async DevServer.pipeImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:959:25)
              at async NextNodeServer.handleCatchallRenderRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\next-server.js:281:17)
              at async DevServer.handleRequestImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\base-server.js:853:17)
              at async C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:371:20
              at async Span.traceAsyncFn (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\trace\trace.js:153:20)
              at async DevServer.handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:368:24)
              at async invokeRender (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:230:21)
              at async handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:408:24)
              at async C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:371:20
              at async Span.traceAsyncFn (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\trace\trace.js:153:20)
              at async DevServer.handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:368:24)
              at async invokeRender (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:230:21)
              at async handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:408:24)
              at async Span.traceAsyncFn (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\trace\trace.js:153:20)
              at async DevServer.handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:368:24)
              at async invokeRender (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:230:21)
              at async handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:408:24)
              at async DevServer.handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\dev\next-dev-server.js:368:24)
              at async invokeRender (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:230:21)
              at async handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:408:24)
              at async invokeRender (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:230:21)
              at async handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:408:24)
              at async handleRequest (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:408:24)
              at async requestHandlerImpl (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\router-server.js:432:13)
              at async Server.requestListener (C:\Users\Korp\Documents\git\IA\korp.analytics.ia.agent-frontend\node_modules\next\dist\server\lib\start-server.js:146:13)
      "path": [
        "generateCopilotResponse"
      ],
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "extensions": {
        "name": "CopilotError",
        "statusCode": 503
      }
    }
 POST /api/copilotkit 200 in 307631ms


Backend Python (FastAPI) the request for my new messages don`t show here:
INFO:     127.0.0.1:56645 - "POST /relatorio/analytics/ia/copilotkit/info HTTP/1.1" 200 OK
INFO:     127.0.0.1:56649 - "POST /relatorio/analytics/ia/copilotkit/agents/execute HTTP/1.1" 200 OK
INFO:     127.0.0.1:56683 - "POST /relatorio/analytics/ia/copilotkit/info HTTP/1.1" 200 OK
INFO:     127.0.0.1:56687 - "POST /relatorio/analytics/ia/copilotkit/agents/execute HTTP/1.1" 200 OK
INFO:     127.0.0.1:56867 - "POST /relatorio/analytics/ia/copilotkit/info HTTP/1.1" 200 OK
INFO:     127.0.0.1:56871 - "POST /relatorio/analytics/ia/copilotkit/agents/execute HTTP/1.1" 200 OK
INFO:     127.0.0.1:56954 - "POST /relatorio/analytics/ia/copilotkit/info HTTP/1.1" 200 OK
INFO:     127.0.0.1:56958 - "POST /relatorio/analytics/ia/copilotkit/agents/execute HTTP/1.1" 200 OK
INFO:     127.0.0.1:57065 - "POST /relatorio/analytics/ia/copilotkit/info HTTP/1.1" 200 OK
INFO:     127.0.0.1:57241 - "POST /relatorio/analytics/ia/copilotkit/info HTTP/1.1" 200 OK

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 20

Most upvoted comments

We are testing the new version and it appears to have resolved the problem. Let’s cancel today’s meeting and if we find any more problems I’ll let you know. Thank you very much for your attention.

Hello, I scheduled a meeting for today to present the problem in our application.

Hi, I didn’t receive the confirmation email from Calendly. I thought they hadn’t accepted the invitation. I apologize, I only saw it now. I will reschedule.

@NathanTarbert @tylerslaton Thank you Tyler for the help today! Everything is working flawlessly and made a lot of progress today!

Also wanted to share, that running the run() function without any arguments just runs the LangGraph graph so I was able to do what I wanted without any changes.

@NathanTarbert Thank you! I’ve scheduled a session with Tyler tomorrow. I appreciate the quick response since this put a hold on my dev effort.

I’m getting the same error now after upgrading to the latest npm install @copilotkit/react-core@1.5.15 @copilotkit/react-ui@1.5.15 @copilotkit/react-textarea@1.5.15

I’ve tried change based on suggestion to the URL below instead of localhost but it doesn’t work. It was working fine before the upgrade. I’m using langgraph studio in the backend. Do I need to upgrade any packages there for this to resolve?

[Network] Failed to fetch from url http://127.0.0.1:3000/copilotkit.

Possible reasons:

-The server might be down or unreachable -There might be a network issue (e.g., DNS failure, connection timeout) -The URL might be incorrect -The server is not running on the specified port See more: https://docs.copilotkit.ai/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found

I’m having the same problem. I was looking for another tool because this error occurs all the time. Any perspective on fixing this?. It is impractical to use the framework with this error.

Hi @RafaelChicovis & @youest, thanks for flagging this. We are looking into this.