That the Church has infallibly determined what books are in the Canon of scripture is required of believing Catholics. That Trent reaffirmed what earlier Councils and Popes had already stated is also true. (Many Protestants charge that the Catholic Church “added the books” at Trent, which is not true.)
What I have to do is refresh myself as to the timeline of when the Church gave us the official canon. (I believe it was in the mid 300s or early 400’s but I’ll confirm this before I make an “official” statement.
On another topic, infallibility is not always a onetime event. If the Church teaches something, that was defined infallibly, and an individual bishop upholds that dogma of the Faith and teaches it at another time, he is teaching infallibly, because he is stating again what the Church already holds as infallible, so the question may be better asked, when was the Canon of the Bible “First” taught by the Church in an infallible manner.
In the early Church there were several canons accepted by individual groups, or Churches in different parts of the world, it was not until the Church officially taught what the Canon consisted of that it was held as infallible. While it was accepted as authorative, and infallible, the word infallible may not have been used at the time, just as the term Trinity was a later definition to describe what the Church already taught from the beginning.