Hanging by a thread

Generated image of a rope about to break
To be hanging by a thread means being in a very fragile or risky situation where something bad could happen at any moment.

The phrase comes from the image of something suspended by a thin thread that could break at any time.

The deal was hanging by a thread after the last minute disagreement.