{"record":{"id":"ccb117dd892173b4","repo":"alibaba/spring-ai-alibaba","slug":"checkpoint-with-id-s-not-found-ccb117","errorCode":null,"errorMessage":"Checkpoint with id %s not found!","messagePattern":"Checkpoint with id (.+?) not found!","errorType":"exception","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/checkpoint/savers/mysql/MysqlSaver.java","lineNumber":524,"sourceCode":"\t}\n\n\t@Override\n\tprotected void updateCheckpoint(String threadName, String checkpointId, Checkpoint checkpoint) throws Exception {\n\t\tConnection conn = null;\n\t\ttry (Connection ignored = conn = dataSource.getConnection()) {\n\t\t\tconn.setAutoCommit(false);\n\n\t\t\ttry (PreparedStatement preparedStatement = conn.prepareStatement(UPDATE_CHECKPOINT)) {\n\t\t\t\tpreparedStatement.setString(1, checkpoint.getId());\n\t\t\t\tpreparedStatement.setString(2, checkpoint.getNodeId());\n\t\t\t\tpreparedStatement.setString(3, checkpoint.getNextNodeId());\n\t\t\t\tpreparedStatement.setString(4, encodeState(checkpoint.getState()));\n\t\t\t\tpreparedStatement.setString(5, threadName);\n\t\t\t\tpreparedStatement.setString(6, checkpointId);\n\t\t\t\tint rowsAffected = preparedStatement.executeUpdate();\n\t\t\t\tif (rowsAffected == 0) {\n\t\t\t\t\tconn.rollback();\n\t\t\t\t\tthrow new NoSuchElementException(format(\"Checkpoint with id %s not found!\", checkpointId));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconn.commit();\n\t\t\tlog.debug(\"Checkpoint with id {} for thread {} updated successfully.\", checkpoint.getId(), threadName);\n\t\t}\n\t\tcatch (SQLException | IOException ex) {\n\t\t\tlog.error(\"Error updating checkpoint with id {} in thread {}\", checkpoint.getId(), threadName, ex);\n\t\t\trollback(conn, checkpoint, threadName);\n\t\t\tthrow new Exception(\"Unable to update checkpoint\", ex);\n\t\t}\n\t}\n\n\t@Override\n\tprotected void deleteCheckpoints(String threadName, Collection<String> checkpointIds) throws Exception {\n\t\tif (checkpointIds.isEmpty()) {\n\t\t\treturn;\n\t\t}","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/checkpoint/savers/mysql/MysqlSaver.java#L506-L542","documentation":"updateCheckpoint() executes an UPDATE of an existing checkpoint and, if executeUpdate() affects zero rows, rolls back and throws NoSuchElementException with 'Checkpoint with id %s not found!'. This means the (threadName, checkpointId) pair did not match any row — the update target does not exist in the database.","triggerScenarios":"Calling updateCheckpoint (directly or via the checkpointer's update path, e.g. replay/time-travel) with a checkpointId that was never inserted, was already deleted by retention policy, or belongs to a different threadName.","commonSituations":"Stale checkpoint id reused after the checkpoint was pruned by history-limit cleanup; typos or mixing thread ids when addressing checkpoints; concurrent deletion by another process; attempting to update in a fresh database where only inserts happened.","solutions":["Verify the checkpointId exists for that threadName (query the checkpoints table or list checkpoints first).","If the intent was to create, call insertCheckpoint instead of updateCheckpoint.","Check whether a retention/cleanup job deleted the checkpoint between fetch and update.","Confirm the threadName matches the one the checkpoint was saved under."],"exampleFix":"// before\nsaver.updateCheckpoint(threadId, checkpointId, cp); // NoSuchElementException if absent\n// after\nif (saver.getCheckpoint(threadId, checkpointId).isPresent()) {\n    saver.updateCheckpoint(threadId, checkpointId, cp);\n} else {\n    saver.insertCheckpoint(threadId, cp);\n}","handlingStrategy":"validation","validationCode":"boolean exists = saver.getCheckpoint(threadId, checkpointId).isPresent();\nif (!exists) throw new IllegalStateException(\"checkpoint \" + checkpointId + \" missing before update\");","typeGuard":null,"tryCatchPattern":"try {\n    saver.updateCheckpoint(threadId, checkpointId, cp);\n} catch (NoSuchElementException e) {\n    saver.insertCheckpoint(threadId, cp); // upsert pattern\n}","preventionTips":["Prefer insert-or-update (upsert) semantics when unsure the checkpoint exists.","Account for retention policies that may delete checkpoints concurrently.","Never reuse checkpoint ids across threads."],"tags":["mysql","checkpoint","update","not-found"],"backgroundTag":"record-not-found","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}