diff --git a/server/instances.go b/server/instances.go index a62ed0db4..bffd3f2d8 100644 --- a/server/instances.go +++ b/server/instances.go @@ -5,6 +5,7 @@ package main import ( "net/http" + "strings" "github.com/mattermost/mattermost-server/v6/model" "github.com/pkg/errors" @@ -187,6 +188,15 @@ func (p *Plugin) UninstallInstance(instanceID types.ID, instanceType InstanceTyp var err error instance, err = p.instanceStore.LoadInstance(instanceID) if err != nil { + if strings.Contains(err.Error(), "not found") { + instances.Delete(instanceID) + if err = p.instanceStore.StoreInstances(instances); err != nil { + return err + } else { + return nil + } + } + return err } if instanceType != instance.Common().Type {