Problems adding a termbase to a Studio project

Hi all,

I'm working on a Studio plugin that creates and adds a new local termbase to an existing project. This worked for a long time - and still does - as long as only local or sever MultiTerm termbases are involved. If I throw in a terminology provider (IATE) in the mix, things go wrong. Assuming we opened a project that already has the IATE  plugin installed, these are the basic steps to add the new termbase.:

  1. LocalTermbase termbase = new LocalTermbase(termbasePath) {
    Name = "...",
    SettingsXML = "..."
    };
  2. TermbaseConfiguration termbaseConfig = project.GetTermbaseConfiguration();
    note that the ServerTermbase property is null, and the IATE "termbase" is of type ...Core.ServerTermbase  

  3. termbaseConfig.Termbases.Add(termbase)

  4. [check languages, details should be irrelevant for the problem]

  5. project.UpdateTermbaseConfiguration(termbaseConfig);

This is where I get an error: System.ArgumentException: You have to specify TermbaseServerUri when adding server termbases.

I found that I can use the <Path> value from the SettingsXML of the plugin. if I set the ServerUri to that value, the error does no longer happen. But that means I can't use server termbases any longer, since there is only one ServerUri shared among all termbases. This also prevents using more than one server termbases. Can anybody see where I'm going wrong?

Trados Studio 2022 SR2 - 17.2.9.18688