{"record":{"id":"fdc6c0be5c221552","repo":"alibaba/spring-ai-alibaba","slug":"checkpoint-with-id-s-not-found-fdc6c0","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/oracle/OracleSaver.java","lineNumber":497,"sourceCode":"\tprotected void updateCheckpoint(String threadName, String checkpointId, Checkpoint checkpoint) throws Exception {\n\t\tConnection conn = null;\n\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\tString encodedState = encodeState(checkpoint.getState());\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.setObject(4, encodedState, OracleType.JSON);\n\t\t\t\tpreparedStatement.setString(5, stateSerializer.contentType());\n\t\t\t\tpreparedStatement.setString(6, checkpointId);\n\t\t\t\tpreparedStatement.setString(7, threadName);\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":479,"sourceCodeEnd":515,"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/oracle/OracleSaver.java#L479-L515","documentation":"updateCheckpoint executes an UPDATE for the given thread and checkpoint id; if executeUpdate returns 0 rows affected, no row matched, the transaction is rolled back and a NoSuchElementException 'Checkpoint with id %s not found!' is thrown. This is a sentinel signaling the checkpoint you tried to update does not exist in the store.","triggerScenarios":"Calling updateCheckpoint (directly or via a save/update path that assumes an existing checkpoint) with a checkpointId that was never inserted, was deleted by retention (deleteCheckpoints), or belongs to a different thread.","commonSituations":"Retention policies deleting old checkpoints that are then updated; passing a checkpoint id from a different thread; re-running from an in-memory checkpoint that was never persisted; race with a concurrent delete.","solutions":["Confirm the checkpoint id and thread name are correct and that the checkpoint was inserted before the update","Check whether retention (deleteCheckpoints) removed the checkpoint before the update; adjust history limits or ordering","Insert the checkpoint first if it may not exist, or handle NoSuchElementException to fall back to insert","Query the table (SELECT by thread/checkpoint id) to verify existence before updating"],"exampleFix":"// before: blind update, may throw NoSuchElementException\nsaver.updateCheckpoint(threadName, checkpointId, checkpoint);\n// after: guard with existence check\nif (saver.getTuple(threadName, checkpointId).isPresent()) {\n    saver.updateCheckpoint(threadName, checkpointId, checkpoint);\n} else {\n    saver.put(threadName, checkpoint);\n}","handlingStrategy":"validation","validationCode":"// confirm the checkpoint exists (and is for this thread) before updating\nOptional<Checkpoint> existing = saver.getTuple(threadName, checkpointId);\nif (existing.isEmpty()) {\n    // insert instead of update, or surface a clear 'checkpoint gone' condition\n}","typeGuard":null,"tryCatchPattern":"try {\n    // update checkpoint\n} catch (NoSuchElementException e) {\n    // checkpoint missing (deleted by retention or wrong id): re-insert or re-derive\n    log.warn(\"Checkpoint {} no longer stored; recreating\", checkpointId);\n    saver.put(threadName, checkpoint);\n}","preventionTips":["Order retention/deletion so checkpoints still referenced are never trimmed","Use ids returned by the store rather than ids remembered in memory across restarts","Keep update and delete paths within the same owner/lock for a thread","Audit retention limits vs update frequency"],"tags":["checkpoint","oracle","not-found","update","nosuch-element"],"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"}