portainer/portainer · error

failed to migrate custom template %d: %w

Error message

failed to migrate custom template %d: %w

What it means

Error "failed to migrate custom template %d: %w" thrown in portainer/portainer.

Source

Thrown at api/datastore/migrator/migrate_2_43_0.go:324

				if err := m.sourceService.Tx(tx).Update(adminUserContext, srcID, src); err != nil {
					return fmt.Errorf("failed to update source %d for custom template %d: %w", srcID, t.ID, err)
				}
			}

			t.Artifact = &portainer.Artifact{
				Files: []portainer.ArtifactFile{{
					SourceID: srcID,
					Path:     t.GitConfig.ConfigFilePath,
					Ref:      t.GitConfig.ReferenceName,
					Hash:     t.GitConfig.ConfigHash,
				}},
			}
			t.GitConfig = nil

			return m.customTemplateService.Tx(tx).Update(t.ID, t)
		}); err != nil {
			return fmt.Errorf("failed to migrate custom template %d: %w", t.ID, err)
		}

		if newSrcID != 0 {
			sourcesByKey[key] = newSrcID
		}
	}

	return nil
}

View on GitHub (pinned to 17e74456ff)

When it happens

Trigger: Thrown at api/datastore/migrator/migrate_2_43_0.go:324 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of portainer/portainer@17e74456ff (2026-08-26). Data as JSON: /api/errors/5ec81d4779c1b9f8. Report an issue: GitHub.