{"record":{"id":"5ec81d4779c1b9f8","repo":"portainer/portainer","slug":"failed-to-migrate-custom-template-d-w","errorCode":null,"errorMessage":"failed to migrate custom template %d: %w","messagePattern":"failed to migrate custom template (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/datastore/migrator/migrate_2_43_0.go","lineNumber":324,"sourceCode":"\n\t\t\t\tif err := m.sourceService.Tx(tx).Update(adminUserContext, srcID, src); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to update source %d for custom template %d: %w\", srcID, t.ID, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tt.Artifact = &portainer.Artifact{\n\t\t\t\tFiles: []portainer.ArtifactFile{{\n\t\t\t\t\tSourceID: srcID,\n\t\t\t\t\tPath:     t.GitConfig.ConfigFilePath,\n\t\t\t\t\tRef:      t.GitConfig.ReferenceName,\n\t\t\t\t\tHash:     t.GitConfig.ConfigHash,\n\t\t\t\t}},\n\t\t\t}\n\t\t\tt.GitConfig = nil\n\n\t\t\treturn m.customTemplateService.Tx(tx).Update(t.ID, t)\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to migrate custom template %d: %w\", t.ID, err)\n\t\t}\n\n\t\tif newSrcID != 0 {\n\t\t\tsourcesByKey[key] = newSrcID\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":306,"sourceCodeEnd":334,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/datastore/migrator/migrate_2_43_0.go#L306-L334","documentation":"Error \"failed to migrate custom template %d: %w\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/datastore/migrator/migrate_2_43_0.go:324 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}