He spent a month in prison for attempting to quit a job
The nobles typically employed musicians like Bach, and they weren't always treated with much respect. Bach began performing as an organist and later as the conductor of an orchestra for William Ernst, Duke of Sachsen-Weimar, in 1708. He also performed in the court as a chamber musician, taking on yet another array of duties that he had not agreed to. He was unconcerned this time since he was confident that his efforts would result in his promotion to kapellmeister (music director).
Bach asked for and anticipated being elevated to the role of Kapellmeister (chief music creator) when the court's Kapellmeister passed away in 1716. Unfortunately, the Duke chose to install the deceased Kapellmeister's son in his place after five years. Bach demanded his dismissal out of disgust, which angered William Ernst. Before his resignation was accepted, he ordered Bach to be jailed for a month.
Bach, who was naturally inventive, didn't squander his time in jail. He wrote a cycle of organ chorale preludes within that period. This story is considered one of the most interesting facts about Johann Sebastian Bach.