Had I but known
"Had I but known" is a form of prolepsis or foreshadowing that hints at some looming in which the speaker laments their course of action that precipitates an unintended consequence .
Classically, the narrator never makes explicit the nature of the mistake until the reader has realized the consequence of the error. If done well, this literary device can add suspense or dramatic irony; if overdone, it invites comparison of the story to Victorian melodrama.
The foreshadowing may be distinguished from "advance notice": for example, "Had I but known then what I know now, I would never have set foot on Baron von Rotschnitzel's private yacht". The more subtle "advance mention": "a 'simple marker without anticipation' intended to acquire significance later in the narrative, through analeptic recovery.' [in other words:]...clues".