Custom buttons on a service do not work

Hello all,
anyone experienced problems with custom buttons on a service?
The problem is that sometimes the custom buttons we have on a service wont work. The loading circle keeps rotating and then it goes back to the service details instead to the form related to the button. This happens only with some services made by same template. I dont see any link to potential cause. Strange behaviour is also that after some time when I log out and log in again, the same service’s buttons work again. Very random.
Logs show nothing, I can see that the form related to the button is loading but then it stops without error.
When debugging in the browser, there is the following error:

$("#center_div").html("\u003cdiv id=‘content’ style=‘overflow: scroll; height: 100%; padding-left: 50px;’\u003e\n\u003ch1 style=‘color: #c90813’\u003e\nUnexpected error encountered\n\u003c/h1\u003e\n\u003cbr\u003e\n\u003ch2\u003e\nErrors in Management Engine can be caused by:\n\u003c/h2\u003e\n\u003cbr\u003e\n\u003cfieldset\u003e\n\u003cfont style=‘font-size: 116%;color: black’\u003e\u0026#x2460;\u003c/font\u003e\nAccessing Management Engine from multiple tabs or windows of the same browser on a single machine.\nClose any duplicate browser sessions, then select an option from the menu.\n\u003c/fieldset\u003e\n\u003cfieldset\u003e\n\u003cfont style=‘font-size: 116%;color: black’\u003e\u0026#x2461;\u003c/font\u003e\nPressing the back button during a session.\n\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\nClose any duplicate browser sessions, then select an option from the menu.\n\u003c/fieldset\u003e\n\u003cfieldset\u003e\n\u003cfont style=‘font-size: 116%;color: black’\u003e\u0026#x2462;\u003c/font\u003e\nAn internal system error.\n\u003cbr\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\nPlease contact your administrator for assistance.\n\u003c/fieldset\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003ch2\u003e\nError text:\n\u003c/h2\u003e\n\u003cbr\u003e\n\u003ch3\u003e\nundefined method `ancestry\u0026#39; for #\u0026lt;Dialog:0x000000001327ca78\u0026gt; [service/button]\n\u003c/h3\u003e\n\u003c/div\u003e\n");

Edit: I found similar error in production.log
[----] F, [2021-08-12T13:56:02.802271 #3656:4ac313c] FATAL – : Error caught: [ActionView::Template::Error] undefined method ancestry' for #<Dialog:0x000000001781e4f0> /usr/local/lib/ruby/gems/2.5.0/gems/activemodel-5.1.7/lib/active_model/attribute_methods.rb:432:in method_missing’
/usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-ui-classic-d44320707dfe/app/controllers/mixins/breadcrumbs_mixin.rb:120:in ancestry_parents' /usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-ui-classic-d44320707dfe/app/controllers/mixins/breadcrumbs_mixin.rb:42:in data_for_breadcrumbs’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/abstract_controller/helpers.rb:68:in data_for_breadcrumbs' /usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-ui-classic-d44320707dfe/app/views/layouts/_breadcrumbs.html.haml:1:in __usr_local_lib_ruby_gems_______bundler_gems_manageiq_ui_classic_d________dfe_app_views_layouts__breadcrumbs_html
_haml___1363315422151431210_195353520’
/usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/template.rb:157:in block in render' /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:168:in instrument’
/usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/template.rb:352:in instrument_render_template' /usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/template.rb:155:in render’
/usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/renderer/partial_renderer.rb:342:in block in render_partial' /usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/renderer/abstract_renderer.rb:42:in block in instrument’
/usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in block in instrument' /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications/instrumenter.rb:21:in instrument’
/usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in instrument' /usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/renderer/abstract_renderer.rb:41:in instrument’
/usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/renderer/partial_renderer.rb:331:in render_partial' /usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/renderer/partial_renderer.rb:310:in render’
/usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/renderer/renderer.rb:47:in render_partial' /usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/renderer/renderer.rb:21:in render’
/usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/rendering.rb:103:in _render_template' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/streaming.rb:217:in _render_template’
/usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/rendering.rb:83:in render_to_body' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/rendering.rb:52:in render_to_body’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/renderers.rb:141:in render_to_body' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/abstract_controller/rendering.rb:46:in render_to_string’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/rendering.rb:41:in render_to_string' /usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-ui-classic-d44320707dfe/app/helpers/application_helper.rb:1273:in block in r’
/usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-ui-classic-d44320707dfe/app/controllers/service_controller.rb:493:in replace_right_cell' /usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-ui-classic-d44320707dfe/app/controllers/application_controller/dialog_runner.rb:166:in dialog_initialize’
/usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-ui-classic-d44320707dfe/app/controllers/application_controller/buttons.rb:343:in custom_buttons' /usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-ui-classic-d44320707dfe/app/controllers/service_controller.rb:26:in button’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/basic_implicit_render.rb:4:in send_action' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/abstract_controller/base.rb:186:in process_action’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/rendering.rb:30:in process_action' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/abstract_controller/callbacks.rb:20:in block in process_action’
/usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.7/lib/active_support/callbacks.rb:131:in run_callbacks' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/abstract_controller/callbacks.rb:19:in process_action’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/rescue.rb:20:in process_action' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/instrumentation.rb:32:in block in process_action’
/usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in block in instrument' /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications/instrumenter.rb:21:in instrument’
/usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.1.7/lib/active_support/notifications.rb:166:in instrument' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/instrumentation.rb:30:in process_action’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal/params_wrapper.rb:252:in process_action' /usr/local/lib/ruby/gems/2.5.0/gems/activerecord-5.1.7/lib/active_record/railties/controller_runtime.rb:22:in process_action’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/abstract_controller/base.rb:124:in process' /usr/local/lib/ruby/gems/2.5.0/gems/actionview-5.1.7/lib/action_view/rendering.rb:30:in process’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal.rb:189:in dispatch' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_controller/metal.rb:253:in dispatch’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_dispatch/routing/route_set.rb:49:in dispatch' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_dispatch/routing/route_set.rb:31:in serve’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_dispatch/journey/router.rb:50:in block in serve' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_dispatch/journey/router.rb:33:in each’
/usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_dispatch/journey/router.rb:33:in serve' /usr/local/lib/ruby/gems/2.5.0/gems/actionpack-5.1.7/lib/action_dispatch/routing/route_set.rb:844:in call’
/usr/local/lib/ruby/gems/2.5.0/bundler/gems/manageiq-graphql-6f72cac80e16/lib/manageiq/graphql/rest_api_proxy.rb:18:in call' /usr/local/lib/ruby/gems/2.5.0/gems/secure_headers-3.0.3/lib/secure_headers/middleware.rb:10:in call’
/var/www/miq/vmdb/lib/request_started_on_middleware.rb:12:in call' /usr/local/lib/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/etag.rb:27:in call’

Anyone has a hint or experienced similar problem?
Any help would be appreciated
Thank you