{"record":{"id":"c849000018a2695d","repo":"bytedance/deer-flow","slug":"could-not-find-an-addressable-checkpoint-before-th","errorCode":null,"errorMessage":"Could not find an addressable checkpoint before the target user message","messagePattern":"Could not find an addressable checkpoint before the target user message","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"warning","filePath":"backend/app/gateway/routers/thread_runs.py","lineNumber":559,"sourceCode":"            )\n        except CheckpointLineageError as exc:\n            logger.warning(\n                \"Rejected unsafe checkpoint lineage for regenerate thread %s\",\n                sanitize_log_param(thread_id),\n                exc_info=True,\n            )\n            raise HTTPException(status_code=409, detail=_UNSAFE_REGENERATE_LINEAGE_DETAIL) from exc\n    try:\n        raw_checkpoints = await accessor.ahistory(base_config, limit=REGENERATE_HISTORY_RAW_SCAN_LIMIT)\n        checkpoints = [item for item in raw_checkpoints if not _is_duration_only_checkpoint(item)]\n    except Exception as exc:\n        logger.exception(\"Failed to list checkpoints for regenerate thread %s\", thread_id)\n        raise HTTPException(status_code=500, detail=\"Failed to inspect checkpoint history\") from exc\n\n    previous_checkpoint, target_found = find_checkpoint_before_message_chronologically(raw_checkpoints, human_message_id)\n    if target_found:\n        if previous_checkpoint is None:\n            raise HTTPException(\n                status_code=409,\n                detail=_MISSING_REGENERATE_BASE_DETAIL,\n            )\n        return previous_checkpoint\n\n    if len(checkpoints) >= REGENERATE_HISTORY_SCAN_LIMIT:\n        logger.warning(\n            \"Could not locate target user message %s in recent checkpoint history for thread %s (limit=%s)\",\n            human_message_id,\n            thread_id,\n            REGENERATE_HISTORY_SCAN_LIMIT,\n        )\n    raise HTTPException(\n        status_code=409,\n        detail=(f\"Could not locate target user message in recent checkpoint history (limit={REGENERATE_HISTORY_SCAN_LIMIT})\"),\n    )\n\n","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/thread_runs.py#L541-L577","documentation":"Raised in _find_base_checkpoint_before_human (HTTP 409, detail _MISSING_REGENERATE_BASE_DETAIL) when the target user message was found in checkpoint history but there is no checkpoint before it (previous_checkpoint is None). The target turn is the very first thing that ever checkpointed in the thread, so there is no earlier addressable checkpoint to replay from.","triggerScenarios":"Regenerating the first user turn of a thread: find_checkpoint_before_message_chronologically locates the target but has no preceding checkpoint to return; all earlier checkpoints were duration-only stubs and got filtered; thread history was pruned down to the target turn.","commonSituations":"Fresh thread where the user immediately regenerates the first response; aggressive checkpoint retention keeping only recent history.","solutions":["For a first-turn regenerate, resend the (possibly edited) user message as a new run instead of using regenerate-replay semantics.","Verify the run you are regenerating is not the thread's only/first checkpointed turn; pick a later turn if available.","If history pruning is enabled, widen retention so a base checkpoint before the target exists.","Confirm with the checkpoint store listing that at least one earlier checkpoint exists for the thread."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const cps = await listCheckpoints(threadId);\nconst targetIdx = cps.findIndex(c => c.contains_message_id === humanMessageId);\nif (targetIdx <= 0) { // no earlier checkpoint: resend instead of regenerate }","typeGuard":null,"tryCatchPattern":"try { await regeneratePrepare(threadId, messageId); } catch (e) { if (e.status === 409 && /addressable checkpoint before/.test(e.detail)) { await resendMessage(threadId, editedText); } else throw e; }","preventionTips":["Detect first-turn regenerates client-side and offer 'resend' instead","Widen checkpoint retention for threads users will revisit"],"tags":["regenerate","checkpoint","first-turn","http-409"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}