NousResearch/hermes-agent · error · Error

Could not find the message to restore.

Error message

Could not find the message to restore.

What it means

Error "Could not find the message to restore." thrown in NousResearch/hermes-agent.

Source

Thrown at apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.ts:310

  truncateOrdinal: number
  truncateMessageId?: string
  truncateRowId?: number
}

/** Resolve the user turn to rewind to; throws with a user-facing reason. */
export function planRestore(messages: ChatMessage[], messageId: string, target?: RestoreTarget): RestorePlan {
  const idIndex = messages.findIndex(m => m.id === messageId && m.role === 'user')

  const fallbackIndex =
    target?.userOrdinal === null || target?.userOrdinal === undefined
      ? -1
      : visibleUserIndexAtOrdinal(messages, target.userOrdinal)

  const sourceIndex = idIndex >= 0 ? idIndex : fallbackIndex
  const source = messages[sourceIndex]

  if (!source || source.role !== 'user') {
    throw new Error('Could not find the message to restore.')
  }

  const text = (chatMessageText(source).trim() || target?.text?.trim() || '').trim()

  if (!text) {
    throw new Error('Cannot restore an empty message.')
  }

  const truncateOrdinal =
    target?.userOrdinal === null || target?.userOrdinal === undefined
      ? visibleUserOrdinal(messages, sourceIndex)
      : target.userOrdinal

  return { sourceIndex, text, truncateOrdinal, truncateMessageId: source.id, truncateRowId: source.rowId }
}

// ---------------------------------------------------------------------------
// Edit (revert + resubmit with new text)

View on GitHub (pinned to c896c09c42)

Solutions

  1. Reload the session; the message list is stale or the message was removed.
  2. Scroll to load earlier history, then retry the restore on the visible message.

When it happens

Trigger: Thrown at apps/desktop/src/app/session/hooks/use-prompt-actions/rewind.ts:310 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/e26b368ddea969b7. Report an issue: GitHub.