sharepoint online – The definition of property bag values ​​is only sporadically defined

We have created a script / site design that triggers a function application. Some property bag values ​​of the app set feature are:

var adminCtx = ClientContextExtension.GetAppContext ("", Configuration.AppRegistrationId, Configuration.AppRegistrationKey, Logger);
tenant var = new tenant (adminCtx);
tenant.SetSiteProperties (Site.Context.Url, noScriptSite: false);
adminCtx.ExecuteQuery ();

Logger.WriteTrace ("Property found in the database.Definition of propertybag values", SeverityLevel.Verbose);
Site.Context.Web.SetPropertyBagValue ("forvaltning", KKOrg.Forvaltning);
Site.Context.Web.SetPropertyBagValue ("afdeling", KKOrg.Afdeling);
Site.Context.Web.SetPropertyBagValue ("kkorg", KKOrg.KKOrgNr);
Site.Context.Web.Update ();
Site.Context.ExecuteQueryWithIncrementalRetry (3, 5, recorder);

This works about 3 times out of 4. About 25% of the time, this code does not set the values ​​in the property bag. Any ideas what can cause this? I can see in the log that the code is running. Does the site design start too early and then cancel or?