Updating structure field inside a hook

German is your default language, isn’t it?

The problem with your code is that you want to modify $tag in your loop, so you have to change it like this:

    'hooks' => [
      'site.update:after' => function ($newSite,$oldSite) {
        $tags = $newSite->tags()->yaml();
        foreach($tags as &$tag) { // note the `&` in front of `$tag`
          $tag["slugde"] = Str::slug($tag["de"]);
          $tag["slugen"] = Str::slug($tag["en"]);
        }
        $newSite->update([
          'tags' => Data::encode($tags, "yaml")
        ], 'de');
      },
    ],

Apart from that, everything should work. Why are you throwing the exception?

What’s the purpose of creating these slugs?