LangGraph: Checkpointer causes MySQL collation errors (1267/1366) + Hindi TTS loses Devanagari matras #937

Closed
opened 2026-02-20 17:42:26 -05:00 by yindo · 2 comments
Owner

Originally created by @shubhammalik19 on GitHub (Aug 25, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • 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

# Minimal repro: create schema, then simulate the checkpointer using a different
# session collation (utf8mb4_general_ci) which causes MySQL 1267 on comparisons.
# Run with env vars: MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_PORT

import os, pymysql, traceback
from langgraph.graph import StateGraph
from langgraph.checkpoint.mysql.pymysql import PyMySQLSaver

HOST = os.getenv("MYSQL_HOST", "127.0.0.1")
USER = os.getenv("MYSQL_USER", "root")
PWD  = os.getenv("MYSQL_PASSWORD", "")
PORT = int(os.getenv("MYSQL_PORT", "3306"))

def create_schema():
    conn = pymysql.connect(host=HOST, user=USER, password=PWD, port=PORT,
                           charset="utf8mb4", autocommit=True, cursorclass=pymysql.cursors.DictCursor)
    with conn.cursor() as cur:
        cur.execute("DROP DATABASE IF EXISTS langgraph_repro")
        cur.execute("CREATE DATABASE langgraph_repro CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci")
        cur.execute("USE langgraph_repro")
        # users uses unicode_ci
        cur.execute("CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci)")
        # chat_sessions intentionally uses general_ci (mismatch)
        cur.execute("CREATE TABLE chat_sessions (id INT AUTO_INCREMENT PRIMARY KEY, session_title VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, user_id INT)")
        cur.execute(\"INSERT INTO users (username) VALUES ('testuser')\")
        cur.execute(\"INSERT INTO chat_sessions (session_title, user_id) VALUES ('testuser', 1)\")
    conn.close()

def simulate_checkpointer_and_run_join():
    # This connection simulates the checkpointer: set its session collation to general_ci
    conn_cp = pymysql.connect(host=HOST, user=USER, password=PWD, port=PORT,
                              charset="utf8mb4", autocommit=True, cursorclass=pymysql.cursors.DictCursor)
    try:
        with conn_cp.cursor() as cur:
            cur.execute("USE langgraph_repro")
            # set session to a different collation (this simulates the problematic checkpointer)
            cur.execute("SET NAMES utf8mb4 COLLATE utf8mb4_general_ci")
            cur.execute("SET collation_connection = 'utf8mb4_general_ci'")
            # The next statement will raise 1267 if collations are mixed
            cur.execute("SELECT cs.id, cs.session_title, u.username FROM chat_sessions cs JOIN users u ON cs.session_title = u.username")
            rows = cur.fetchall()
            print("Unexpected: query returned rows:", rows)
    except Exception as e:
        # This is the reproduction: OperationalError / 1267 shown here
        print("Expected error from simulated checkpointer (repro):")
        traceback.print_exc()
    finally:
        conn_cp.close()

if __name__ == "__main__":
    create_schema()
    simulate_checkpointer_and_run_join()

# Optional short LangGraph snippet to show how a checkpointer would be attached:
#
# conn_cp = <PyMySQL connection as above>
# saver = PyMySQLSaver(conn_cp)
# g = StateGraph(dict)                       # minimal graph type
# # add nodes and compile with checkpointer -> invoking the graph will surface 1267
# graph = g.compile(checkpointer=saver)
# graph.invoke({...})

Error Message and Stack Trace (if applicable)

Checklist

Provide a concise 1267 (collation mix) traceback to paste — Done
Provide a concise 1366 (incorrect string value) traceback to paste — Done
Short note on where to get the full trace from your app and what else to include — Done
OperationalError: (1267, "Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='")
Traceback (most recent call last):
  File "/home/shubham/laravel/newversion/langgraph_issue/reproduce.py", line 78, in run_join_with_session_collation
    cur2.execute("SELECT cs.id, cs.session_title, u.username FROM chat_sessions cs JOIN users u ON cs.session_title = u.username")
  File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/pymysql/cursors.py", line 323, in _query
    conn.query(q)
  File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/pymysql/connections.py", line 588, in query
    raise exc
pymysql.err.OperationalError: (1267, "Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='")

Pasteable Error Message & Stack Trace (incorrect string value — 1366)


ProgrammingError: (1366, "Incorrect string value: '\\xE0\\xA4\\x95\\xE0\\xA5\\x8D...' for column `newversion`.`chat_sessions`.`session_title` at row 1")
Traceback (most recent call last):
  File "/path/to/your/app/langgraph_agent.py", line 214, in some_save_path
    cursor.execute(\"INSERT INTO chat_sessions (session_title, user_id) VALUES (%s, %s)\", (session_title, user_id))
  File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/mysql/connector/cursor.py", line 565, in execute
    self._handle_result(self._connection.cmd_stmt_execute(stmt))
  File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/mysql/connector/connection.py", line 1160, in cmd_stmt_execute
    raise errors.get_mysql_exception(err_msg, errno)
mysql.connector.errors.ProgrammingError: 1366 (22007): Incorrect string value: '\\xE0\\xA4\\x95\\xE0\\xA5\\x8D...' for column `newversion`.`chat_sessions`.`session_title` at row 1


Suggested small app log excerpt (helpful to include)

2025-08-25 11:42:29 | ERROR | aiapp.ChatAgent | Graph execution failed: (1267, "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='")
2025-08-25 11:42:29 | ERROR | aiapp.ChatAgent | Collation error detected in graph execution
2025-08-25 11:42:29 | ERROR | aiapp.ChatAgent | Chat session failed for user 2: (1267, "Illegal mix of collations ...")

Description

I’m seeing two related issues when running LangGraph with the MySQL checkpointer in my TMS app:

Summary: backend-generated TTS payloads strip Devanagari combining marks (matras) and the MySQL checkpointer triggers collation/encoding errors (1267 / 1366) when session titles or comparisons include non‑ASCII text.

Symptoms

TTS: voice.plain returned by the backend drops Unicode combining marks in Hindi (Devanagari). UI/display text is correct, but speech output becomes gibberish.
DB: Inserts/queries fail with:
1366: Incorrect string value when inserting Hindi into chat_sessions.session_title
1267: Illegal mix of collations (e.g. utf8mb4_unicode_ci vs utf8mb4_general_ci) when comparing text across tables or sessions
Why I think it’s the checkpointer

The errors occur during graph execution when the checkpointer (a separate DB client/connection) runs queries. I reproduced the problem by opening a second DB connection with a different session collation; that connection produces 1267 while the primary connection does not.
Example log excerpt:
Graph execution failed: (1267, "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='")
How to reproduce (attachments included)

I attached a minimal bundle (langgraph_issue.zip) that contains:
reproduce.sql — creates a DB with mixed collations
reproduce.py — runs the schema and simulates a checkpointer connection that sets utf8mb4_general_ci, reproducing the 1267 error
fix_collation.sql — suggested migration to convert table/column to utf8mb4_unicode_ci
logs.txt and report_email.txt
Run: MYSQL_HOST=... MYSQL_USER=... MYSQL_PASSWORD=... MYSQL_PORT=... python reproduce.py (script prints the 1267 OperationalError when the simulated checkpointer runs a JOIN)
Expected behavior

voice.plain should preserve all Unicode combining marks (Devanagari matras) so TTS produces correct Hindi pronunciation.
The checkpointer should use the same charset/collation as the DB (or explicitly set SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci) so inserts and text comparisons do not raise 1267/1366.
Notes & environment

MySQL/MariaDB: (attach your exact version)
Connectors tried: mysql-connector-python and PyMySQL (both tested)
App: Python 3.x, LangGraph used as a checkpointer in the graph runtime
I can provide a small respond() snippet showing where voice.plain is built, or add a Docker Compose repro if helpful.

System Info

Plan: I’ll give (A) a short list of commands to run on your machine, (B) a ready-to-paste system-info block with the values I can fill from your workspace and placeholders for the rest, and (C) a short note about where to find LangGraph/LangChain versions and DB details.

Checklist

Provide commands to collect Python, env, package and MySQL versions — Done
Provide a ready-to-paste System Info block with known values filled and placeholders for you to complete — Done
Note about sensitive values and how to attach environment info securely — Done
Commands to run (copy/paste into your shell)

Python runtime

python3 -V

Virtualenv python (use your venv path if different)

/home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -V

pip freeze (in the same env used by the app)

/home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -m pip freeze

Show specific packages (if installed)

/home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -m pip show PyMySQL mysql-connector-python langchain langchain-core langgraph

MySQL / MariaDB server version (run on the DB server)

mysql --version

If langchain_core.sys_info exists:

/home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -m langchain_core.sys_info

Ready-to-paste “System Info *” block (fill placeholders if needed)

OS: Linux (distribution: <fill e.g. Ubuntu 22.04 or Debian 11>)
Kernel: $(uname -r) # run uname -r and paste value

Python:

  • System python: python3 -> <run python3 -V and paste>
  • Virtualenv python: /home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -> 3.13.6 (detected)

Virtualenv path:

  • /home/shubham/laravel/newversion/aiapp/ai_chat_env

Installed packages (selected):

  • PyMySQL: 1.1.0
  • mysql-connector-python: <paste version if installed, else 'not installed'>
  • langchain / langchain-core / langgraph:
  • Other notable packages:

MySQL / MariaDB:

  • Server: MariaDB 10.11.11 (from SQL dump) # run mysql --version to confirm exact
  • Connector(s) used by app: PyMySQL and/or mysql-connector-python (both tested) — specify which is active in your runtime

Database settings / collation overview (paste if available):

  • Database default charset/collation: utf8mb4 / utf8mb4_unicode_ci
  • Affected table(s): chat_sessions (session_title), messages, checkpoints (if used)
  • Note: in my repro the error showed a mix of utf8mb4_general_ci and utf8mb4_unicode_ci — please include result of:
    SHOW CREATE TABLE chat_sessions;
    SHOW TABLE STATUS WHERE Name='chat_sessions';

App details:

  • LangGraph usage: LangGraph Python checkpointer using PyMySQL / PyMySQLSaver (attached in reproduction)
  • App repo / commit:
  • How run: local dev (virtualenv) on Linux; reproduce script ran with:
    MYSQL_HOST=127.0.0.1 MYSQL_USER=root MYSQL_PASSWORD=12345 MYSQL_PORT=3306 python langgraph_issue/reproduce.py

Repro output summary (paste exact):

  • Observed error: OperationalError: (1267, "Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='")
  • Observed error (insertion): ProgrammingError: (1366, "Incorrect string value: '\xE0\xA4...' for column newversion.chat_sessions.session_title at row 1")

Additional useful info (optional):

  • Full output of python -m langchain_core.sys_info (if available)
  • DB user/privileges used by the checkpointer (do not paste passwords; paste roles/privs only)
    Short guidance on what to paste into the issue

Paste the filled System Info block above into the GitHub "System Info *" field.
Attach the langgraph_issue.zip bundle and the reproduce.py run output (the console output you saw).
Do not paste passwords or secrets; paste only versions, config, and the exact error text.

langgraph_issue.zip

Originally created by @shubhammalik19 on GitHub (Aug 25, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/). - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] 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 ```python # Minimal repro: create schema, then simulate the checkpointer using a different # session collation (utf8mb4_general_ci) which causes MySQL 1267 on comparisons. # Run with env vars: MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_PORT import os, pymysql, traceback from langgraph.graph import StateGraph from langgraph.checkpoint.mysql.pymysql import PyMySQLSaver HOST = os.getenv("MYSQL_HOST", "127.0.0.1") USER = os.getenv("MYSQL_USER", "root") PWD = os.getenv("MYSQL_PASSWORD", "") PORT = int(os.getenv("MYSQL_PORT", "3306")) def create_schema(): conn = pymysql.connect(host=HOST, user=USER, password=PWD, port=PORT, charset="utf8mb4", autocommit=True, cursorclass=pymysql.cursors.DictCursor) with conn.cursor() as cur: cur.execute("DROP DATABASE IF EXISTS langgraph_repro") cur.execute("CREATE DATABASE langgraph_repro CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci") cur.execute("USE langgraph_repro") # users uses unicode_ci cur.execute("CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci)") # chat_sessions intentionally uses general_ci (mismatch) cur.execute("CREATE TABLE chat_sessions (id INT AUTO_INCREMENT PRIMARY KEY, session_title VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, user_id INT)") cur.execute(\"INSERT INTO users (username) VALUES ('testuser')\") cur.execute(\"INSERT INTO chat_sessions (session_title, user_id) VALUES ('testuser', 1)\") conn.close() def simulate_checkpointer_and_run_join(): # This connection simulates the checkpointer: set its session collation to general_ci conn_cp = pymysql.connect(host=HOST, user=USER, password=PWD, port=PORT, charset="utf8mb4", autocommit=True, cursorclass=pymysql.cursors.DictCursor) try: with conn_cp.cursor() as cur: cur.execute("USE langgraph_repro") # set session to a different collation (this simulates the problematic checkpointer) cur.execute("SET NAMES utf8mb4 COLLATE utf8mb4_general_ci") cur.execute("SET collation_connection = 'utf8mb4_general_ci'") # The next statement will raise 1267 if collations are mixed cur.execute("SELECT cs.id, cs.session_title, u.username FROM chat_sessions cs JOIN users u ON cs.session_title = u.username") rows = cur.fetchall() print("Unexpected: query returned rows:", rows) except Exception as e: # This is the reproduction: OperationalError / 1267 shown here print("Expected error from simulated checkpointer (repro):") traceback.print_exc() finally: conn_cp.close() if __name__ == "__main__": create_schema() simulate_checkpointer_and_run_join() # Optional short LangGraph snippet to show how a checkpointer would be attached: # # conn_cp = <PyMySQL connection as above> # saver = PyMySQLSaver(conn_cp) # g = StateGraph(dict) # minimal graph type # # add nodes and compile with checkpointer -> invoking the graph will surface 1267 # graph = g.compile(checkpointer=saver) # graph.invoke({...}) ``` ### Error Message and Stack Trace (if applicable) ```shell Checklist Provide a concise 1267 (collation mix) traceback to paste — Done Provide a concise 1366 (incorrect string value) traceback to paste — Done Short note on where to get the full trace from your app and what else to include — Done OperationalError: (1267, "Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='") Traceback (most recent call last): File "/home/shubham/laravel/newversion/langgraph_issue/reproduce.py", line 78, in run_join_with_session_collation cur2.execute("SELECT cs.id, cs.session_title, u.username FROM chat_sessions cs JOIN users u ON cs.session_title = u.username") File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/pymysql/cursors.py", line 170, in execute result = self._query(query) File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/pymysql/cursors.py", line 323, in _query conn.query(q) File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/pymysql/connections.py", line 588, in query raise exc pymysql.err.OperationalError: (1267, "Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='") Pasteable Error Message & Stack Trace (incorrect string value — 1366) ProgrammingError: (1366, "Incorrect string value: '\\xE0\\xA4\\x95\\xE0\\xA5\\x8D...' for column `newversion`.`chat_sessions`.`session_title` at row 1") Traceback (most recent call last): File "/path/to/your/app/langgraph_agent.py", line 214, in some_save_path cursor.execute(\"INSERT INTO chat_sessions (session_title, user_id) VALUES (%s, %s)\", (session_title, user_id)) File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/mysql/connector/cursor.py", line 565, in execute self._handle_result(self._connection.cmd_stmt_execute(stmt)) File "/home/shubham/laravel/newversion/aiapp/ai_chat_env/lib/python3.13/site-packages/mysql/connector/connection.py", line 1160, in cmd_stmt_execute raise errors.get_mysql_exception(err_msg, errno) mysql.connector.errors.ProgrammingError: 1366 (22007): Incorrect string value: '\\xE0\\xA4\\x95\\xE0\\xA5\\x8D...' for column `newversion`.`chat_sessions`.`session_title` at row 1 Suggested small app log excerpt (helpful to include) 2025-08-25 11:42:29 | ERROR | aiapp.ChatAgent | Graph execution failed: (1267, "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='") 2025-08-25 11:42:29 | ERROR | aiapp.ChatAgent | Collation error detected in graph execution 2025-08-25 11:42:29 | ERROR | aiapp.ChatAgent | Chat session failed for user 2: (1267, "Illegal mix of collations ...") ``` ### Description I’m seeing two related issues when running LangGraph with the MySQL checkpointer in my TMS app: Summary: backend-generated TTS payloads strip Devanagari combining marks (matras) and the MySQL checkpointer triggers collation/encoding errors (1267 / 1366) when session titles or comparisons include non‑ASCII text. Symptoms TTS: voice.plain returned by the backend drops Unicode combining marks in Hindi (Devanagari). UI/display text is correct, but speech output becomes gibberish. DB: Inserts/queries fail with: 1366: Incorrect string value when inserting Hindi into chat_sessions.session_title 1267: Illegal mix of collations (e.g. utf8mb4_unicode_ci vs utf8mb4_general_ci) when comparing text across tables or sessions Why I think it’s the checkpointer The errors occur during graph execution when the checkpointer (a separate DB client/connection) runs queries. I reproduced the problem by opening a second DB connection with a different session collation; that connection produces 1267 while the primary connection does not. Example log excerpt: Graph execution failed: (1267, "Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='") How to reproduce (attachments included) I attached a minimal bundle (langgraph_issue.zip) that contains: [reproduce.sql](vscode-file://vscode-app/usr/share/code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) — creates a DB with mixed collations [reproduce.py](vscode-file://vscode-app/usr/share/code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) — runs the schema and simulates a checkpointer connection that sets utf8mb4_general_ci, reproducing the 1267 error fix_collation.sql — suggested migration to convert table/column to utf8mb4_unicode_ci logs.txt and report_email.txt Run: MYSQL_HOST=... MYSQL_USER=... MYSQL_PASSWORD=... MYSQL_PORT=... python reproduce.py (script prints the 1267 OperationalError when the simulated checkpointer runs a JOIN) Expected behavior voice.plain should preserve all Unicode combining marks (Devanagari matras) so TTS produces correct Hindi pronunciation. The checkpointer should use the same charset/collation as the DB (or explicitly set SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci) so inserts and text comparisons do not raise 1267/1366. Notes & environment MySQL/MariaDB: (attach your exact version) Connectors tried: mysql-connector-python and PyMySQL (both tested) App: Python 3.x, LangGraph used as a checkpointer in the graph runtime I can provide a small respond() snippet showing where voice.plain is built, or add a Docker Compose repro if helpful. ### System Info Plan: I’ll give (A) a short list of commands to run on your machine, (B) a ready-to-paste system-info block with the values I can fill from your workspace and placeholders for the rest, and (C) a short note about where to find LangGraph/LangChain versions and DB details. Checklist Provide commands to collect Python, env, package and MySQL versions — Done Provide a ready-to-paste System Info block with known values filled and placeholders for you to complete — Done Note about sensitive values and how to attach environment info securely — Done Commands to run (copy/paste into your shell) # Python runtime python3 -V # Virtualenv python (use your venv path if different) /home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -V # pip freeze (in the same env used by the app) /home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -m pip freeze # Show specific packages (if installed) /home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -m pip show PyMySQL mysql-connector-python langchain langchain-core langgraph # MySQL / MariaDB server version (run on the DB server) mysql --version # If langchain_core.sys_info exists: # /home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -m langchain_core.sys_info Ready-to-paste “System Info *” block (fill placeholders if needed) OS: Linux (distribution: <fill e.g. Ubuntu 22.04 or Debian 11>) Kernel: $(uname -r) # run `uname -r` and paste value Python: - System python: python3 -> <run `python3 -V` and paste> - Virtualenv python: /home/shubham/laravel/newversion/aiapp/ai_chat_env/bin/python -> 3.13.6 (detected) Virtualenv path: - /home/shubham/laravel/newversion/aiapp/ai_chat_env Installed packages (selected): - PyMySQL: 1.1.0 - mysql-connector-python: <paste version if installed, else 'not installed'> - langchain / langchain-core / langgraph: <paste exact versions from pip show or freeze> - Other notable packages: <paste output of pip freeze or list> MySQL / MariaDB: - Server: MariaDB 10.11.11 (from SQL dump) # run `mysql --version` to confirm exact - Connector(s) used by app: PyMySQL and/or mysql-connector-python (both tested) — specify which is active in your runtime Database settings / collation overview (paste if available): - Database default charset/collation: utf8mb4 / utf8mb4_unicode_ci - Affected table(s): `chat_sessions` (session_title), `messages`, `checkpoints` (if used) - Note: in my repro the error showed a mix of `utf8mb4_general_ci` and `utf8mb4_unicode_ci` — please include result of: SHOW CREATE TABLE chat_sessions; SHOW TABLE STATUS WHERE Name='chat_sessions'; App details: - LangGraph usage: LangGraph Python checkpointer using PyMySQL / PyMySQLSaver (attached in reproduction) - App repo / commit: <paste commit hash or branch if relevant> - How run: local dev (virtualenv) on Linux; reproduce script ran with: MYSQL_HOST=127.0.0.1 MYSQL_USER=root MYSQL_PASSWORD=12345 MYSQL_PORT=3306 python langgraph_issue/reproduce.py Repro output summary (paste exact): - Observed error: OperationalError: (1267, "Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '='") - Observed error (insertion): ProgrammingError: (1366, "Incorrect string value: '\\xE0\\xA4...' for column `newversion`.`chat_sessions`.`session_title` at row 1") Additional useful info (optional): - Full output of `python -m langchain_core.sys_info` (if available) - DB user/privileges used by the checkpointer (do not paste passwords; paste roles/privs only) Short guidance on what to paste into the issue Paste the filled System Info block above into the GitHub "System Info *" field. Attach the langgraph_issue.zip bundle and the [reproduce.py](vscode-file://vscode-app/usr/share/code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) run output (the console output you saw). Do not paste passwords or secrets; paste only versions, config, and the exact error text. [langgraph_issue.zip](https://github.com/user-attachments/files/21962694/langgraph_issue.zip)
yindo added the bugpending labels 2026-02-20 17:42:26 -05:00
yindo closed this issue 2026-02-20 17:42:26 -05:00
Author
Owner

@impptg commented on GitHub (Sep 18, 2025):

I meet the same problem, I tried to create the table by myself, and it works.

Temporary Solution:
Use these commands to view the content of migrations:

use this command to view the content of each migration.

Migration 1:
CREATE TABLE IF NOT EXISTS checkpoints (
thread_id VARCHAR(150) NOT NULL,
checkpoint_ns VARCHAR(150) NOT NULL DEFAULT '',
checkpoint_id VARCHAR(150) NOT NULL,
parent_checkpoint_id VARCHAR(150),
type VARCHAR(150),
checkpoint JSON NOT NULL,
metadata JSON NOT NULL DEFAULT ('{}'),
PRIMARY KEY (thread_id, checkpoint_ns, checkpoint_id)
);
....

Then manually specify COLLATE at the end

CREATE TABLE checkpoints (
......
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

@impptg commented on GitHub (Sep 18, 2025): I meet the same problem, I tried to create the table by myself, and it works. Temporary Solution: Use these commands to view the content of migrations: use this command to view the content of each migration. Migration 1: CREATE TABLE IF NOT EXISTS checkpoints ( thread_id VARCHAR(150) NOT NULL, checkpoint_ns VARCHAR(150) NOT NULL DEFAULT '', checkpoint_id VARCHAR(150) NOT NULL, parent_checkpoint_id VARCHAR(150), type VARCHAR(150), checkpoint JSON NOT NULL, metadata JSON NOT NULL DEFAULT ('{}'), PRIMARY KEY (thread_id, checkpoint_ns, checkpoint_id) ); .... Then manually specify COLLATE at the end CREATE TABLE checkpoints ( ...... ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Author
Owner

@eyurtsev commented on GitHub (Nov 7, 2025):

PyMySQLSaver is not maintain by the langhcain team. I'm closing this issue, and would suggest raising it here: https://github.com/tjni/langgraph-checkpoint-mysql

@eyurtsev commented on GitHub (Nov 7, 2025): `PyMySQLSaver` is not maintain by the langhcain team. I'm closing this issue, and would suggest raising it here: https://github.com/tjni/langgraph-checkpoint-mysql
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#937