Bosses raised alarm privately with Scottish Government and Edinburgh City Council during this year’s festival over prospect of legal action