From 42ea6a53e52f0604fe7f777e681638afab12d4fd Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Tue, 28 Jul 2026 16:38:01 +0300 Subject: [PATCH] fix(datastore): skip missing stacks in 2.44.0 source-interval migration [BE-13277] (#3323) --- api/datastore/migrator/migrate_2_44_0.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/datastore/migrator/migrate_2_44_0.go b/api/datastore/migrator/migrate_2_44_0.go index e373117677..2f7d1a5d0c 100644 --- a/api/datastore/migrator/migrate_2_44_0.go +++ b/api/datastore/migrator/migrate_2_44_0.go @@ -5,6 +5,7 @@ import ( "time" portainer "github.com/portainer/portainer/api" + "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/dataservices/source" "github.com/rs/zerolog/log" @@ -38,6 +39,9 @@ func (m *Migrator) backfillSourceInterval_2_44_0() error { intervalByStack := make(map[portainer.StackID]string, len(referencedStackIDs)) for stackID := range referencedStackIDs { s, err := m.stackService.Read(stackID) + if dataservices.IsErrObjectNotFound(err) { + continue + } if err != nil { return fmt.Errorf("failed to read stack %d: %w", stackID, err) } @@ -107,6 +111,9 @@ func (m *Migrator) backfillSourceIntervalForGroup_2_44_0(tx portainer.Transactio func (m *Migrator) clearAutoUpdateInterval_2_44_0(tx portainer.Transaction, stackID portainer.StackID) error { s, err := m.stackService.Tx(tx).Read(stackID) + if dataservices.IsErrObjectNotFound(err) { + return nil + } if err != nil { return fmt.Errorf("failed to read stack %d: %w", stackID, err) }