they fail a lot.
Jenkins is not some magical beast, it simply runs commands on a machine.
Try debugging it like you would debug failures on your local machine, with the exception that you can't debug interactively (although you can do even that to some degree by running pipeline commands on the node). For example
check you environment variables