Skip to content
This repository was archived by the owner on Mar 12, 2026. It is now read-only.
This repository was archived by the owner on Mar 12, 2026. It is now read-only.

🐛 Bug: useCopilotChat reloadMessages and reset not working #1

@copilotkit-support

Description

@copilotkit-support

♻️ Reproduction Steps

  1. Use LangGraph Python as the backend agent server with Copilotkit and langgraph up with port 8123.
  2. Connect to localhost:8123 in CopilotRuntime (route.ts)
const runtime = new CopilotRuntime({
  remoteEndpoints: [
    langGraphPlatformEndpoint({
      deploymentUrl: process.env.LANGGRAPH_DEPLOYMENT_URL || 'http://localhost:8123', // matches langgraph dev port
      langsmithApiKey: process.env.LANGSMITH_API_KEY || '',
      agents: [{ name: 'demo_agent', description: 'A Demo LLM agent.' }],
    }),
  ],
});
  1. Run reloadMessages and reset in useCopilotChat()
const {
  visibleMessages,
  appendMessage,
  setMessages,
  deleteMessage,
  stopGeneration,
  isLoading,
  reloadMessages,
  reset,
} = useCopilotChat();

<button onClick={() => reloadMessages(msg.id)}>Reload Message</button>
<button onClick={reset}>Reset</button>

✅ Expected Behavior

reloadMessages

Regenerate the target msg and continue chat.

reset

Reset the entire thread.

❌ Actual Behavior

reloadMessages

It doesn't regenerate but only remove the target message. Typing new chat message returns backend error.
ValueError: Message dict must contain 'role' and 'content' keys, got {'lc': 1, 'type': 'constructor', 'id': ['langchain_core', 'messages', 'RemoveMessage'], 'kwargs': {'id': 'ck-dd1f6760-1f39-44da-91f6-af1e0de5b166', 'content': '', 'additional_kwargs': {}, 'response_metadata': {}}}

reset

Typing new chat message returns backend error after resetting the chat. Error returned:
ValueError: Message dict must contain 'role' and 'content' keys, got {'lc': 1, 'type': 'constructor', 'id': ['langchain_core', 'messages', 'RemoveMessage'], 'kwargs': {'id': 'ck-dd1f6760-1f39-44da-91f6-af1e0de5b166', 'content': '', 'additional_kwargs': {}, 'response_metadata': {}}}

𝌚 CopilotKit Version

1.9.1

📄 Logs (Optional)

Both errors point to the langchain_core function RemoveMessage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions