Questions & Answers about Estaba en la biblioteca y, de pronto, se me olvidó la contraseña.
Estaba is the imperfect, which is often used to give background information or describe an ongoing situation in the past.
So in Estaba en la biblioteca, the speaker is setting the scene: they were in the library when something happened.
If you said Estuve en la biblioteca, it would sound more like I was in the library / I spent time in the library as a completed event, not just background.
A useful contrast is:
De pronto means suddenly or all of a sudden.
It introduces the unexpected event:
Other common Spanish expressions with a similar meaning are:
- de repente
- de golpe (more informal in some contexts)