bytedance/deer-flow · warning · HTTPException
Message {message_id} not found
Error message
Message {message_id} not found What it means
Raised in _prepare_regenerate_payload (HTTP 404) when message_id matches no message in the latest checkpoint AND the interrupted-run fallback (server-stamped run_id on the latest user message, only when that run has status 'interrupted') yields nothing. The message the client wants to regenerate is unknown to the checkpointed state.
Source
Thrown at backend/app/gateway/routers/thread_runs.py:654
logger.exception("Failed to read latest checkpoint for regenerate thread %s", thread_id)
raise HTTPException(status_code=500, detail="Failed to read latest checkpoint") from exc
latest_checkpoint_id = _checkpoint_configurable(latest_checkpoint).get("checkpoint_id")
if not latest_checkpoint_id:
raise HTTPException(status_code=404, detail=f"Thread {thread_id} has no checkpoint")
messages = _checkpoint_messages(latest_checkpoint)
target_index = next((i for i, message in enumerate(messages) if _message_id(message) == message_id), None)
if target_index is None:
# A response interrupted during an LLM call can be visible in the live
# stream without ever reaching a checkpoint. The server-stamped run ID
# on the latest user message is the durable link to that partial turn.
previous_human = next(
(message for message in reversed(messages) if _is_visible_human_message(message)),
None,
)
target_run_id = await _find_interrupted_target_run_id(thread_id, previous_human, request) if previous_human is not None else None
if target_run_id is None:
raise HTTPException(status_code=404, detail=f"Message {message_id} not found")
else:
target_message = messages[target_index]
if not _is_visible_ai_message(target_message):
raise HTTPException(status_code=409, detail="Only visible assistant messages can be regenerated")
latest_visible_ai = next((message for message in reversed(messages) if _is_visible_ai_message(message)), None)
if _message_id(latest_visible_ai) != message_id:
raise HTTPException(status_code=409, detail="Only the latest assistant message can be regenerated")
previous_human = next((message for message in reversed(messages[:target_index]) if _is_visible_human_message(message)), None)
target_run_id = (
await _find_target_run_id(
thread_id,
message_id,
target_message,
previous_human,
request,
)View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Refetch thread state and regenerate a message id that appears in the checkpointed messages list.
- Wait until the current run finishes (or is clearly interrupted) before regenerating its output.
- Ensure the frontend uses server-assigned message ids for regenerate targets.
Defensive patterns
Strategy: validation
Validate before calling
const st = await getThreadState(threadId);
const exists = st.messages.some(m => m.id === messageId);
if (!exists && !isRunInterrupted(st.latest_run)) { await refreshThread(threadId); return; } Type guard
function messageExistsInState(messages: {id?: string}[], id: string): boolean {
return messages.some(m => m.id === id);
} Try / catch
try { await regeneratePrepare(threadId, messageId); } catch (e) { if (e.status === 404 && /not found/.test(e.detail)) { await refreshThread(threadId); } else throw e; } Prevention
- Disable regenerate while the run is streaming
- Use server message ids
- Refresh transcript before rewind actions
When it happens
Trigger: Regenerating a streaming-only message that never checkpointed while its run is not in interrupted status (e.g. still running or already succeeded elsewhere); passing a client-side message id; message from a different thread.
Common situations: Regenerate clicked while the target response is mid-stream; stale UI state after the thread advanced; id confusion between UI-rendered messages and checkpointed ones.
Related errors
- Thread {thread_id} has no checkpoint
- The source user message is missing an id
- Request failed.
- Thread {thread_id} not found
- Agent '{name}' not found
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/d72d373eb1331669.
Report an issue: GitHub.