LSP formatting doesn't always work

When you see the issue, what’s the output of :LspInfo? Perhaps it’s the bug where clients are randomly getting detached from buffers? (See Prevent detaching LSP Clients)

What do you see in the logs? Can you try setting the log level to trace and see if you see the requests going out to the server?