There's a great example from the UK of why international treaties and agreements need to be published: because sometimes, they effectively constitute secret law. And in the case of Anne Sacoolas, its a secret law which effectively lets some Americans murder freely:
Harry Dunn, 19, died last summer after his motorbike collided with a car near RAF Croughton in Northamptonshire. Anne Sacoolas, the wife of a US agent who worked at the base, has been charged with causing death by dangerous driving and has apologised to Dunn’s family, but is refusing to return to Britain.
US secretary of state Mike Pompeo has rejected the UK’s request for her extradition, claiming that at the time of the collision she had immunity from criminal prosecution, even though her husband did not.
The Foreign Office has confirmed the existence of a secret agreement between the UK and the US, signed in 1995, granting US staff working at the base diplomatic immunity, though they are still subject to criminal prosecution under UK law.
Foreign secretary Dominic Raab has told parliament that in his view an anomaly in the agreement meant that, while the US staff had waived their rights to be protected against criminal prosecution in the UK, this did not extend to their families. He has pledged to redraft the agreement after learning about the loophole.
Lawyers for Dunn's family are trying to get the agreement published to see if it actually says that, or whether this is a convenient lie by the Foreign Secretary to cover up for a close ally whisking its people out of the country to avoid a murder charge. Of course, if the agreement had been published when it was made, there would be no question about the situation, and any error like that would likely have been fixed long ago. Which would seen to be in everyone's best interests. Except, I suppose, that of American murderers.