Keycloak prints the page source code to users instead of displaying the page

Hello there,

I am struggle with some issue that I can’t handle myself and your help is needed. I am using Keycloak 10.0.2 embedded in Spring Boot 2.2.6. My problem is with VERIFY_EMAIL and UPDATE_PASSWORD expired/non valid links send to users via email. When user click e.g. expired link, he would see error.ftl source code instad of page. Chrome view-source shows something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "">
<html xmlns="" class="login-pf">

	<meta charset="utf-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="robots" content="noindex, nofollow">

			<meta name="viewport" content="width=device-width,initial-scale=1"/>

	<title>Log in to XXXXXXXXX</title>
	<link rel="icon" href="/auth/resources/qkb5s/login/keycloak/img/favicon.png" />

			<link href="/auth/resources/qkb5s/login/keycloak/node_modules/patternfly/dist/css/patternfly.min.css" rel="stylesheet" />
			<link href="/auth/resources/qkb5s/login/keycloak/css/patternfly-additions.min.css" rel="stylesheet" />
			<link href="/auth/resources/qkb5s/login/keycloak/lib/zocial/zocial.css" rel="stylesheet" />
			<link href="/auth/resources/qkb5s/login/keycloak/css/login.css" rel="stylesheet" />

<body class="">
  <div class="login-pf-page">
	<div id="kc-header" class="login-pf-page-header">
	<div class="card-pf ">
	  <header class="login-pf-header">
				<h1 id="kc-page-title">        We are sorry...
	  <div id="kc-content">
		<div id="kc-content-wrapper">

		<div id="kc-error-message">
			<p class="instruction">Action expired.</p>



and page that users sees:

I am using custom theme but issue occur on default keycloak theme too.

Before link expire, page is displayed correctly.

I’ve been working on this issue for a few days, any help or hint will be very helpful.

I made a mistake. Actualy error.ftl is displayed correctly on keycloak default theme. During test i change theme in keycloak admin panel, but forgot to “unregister” custom “LoginFormsProviderFactory” SPI.

Still had no idea why my error.ftl not working. I copied whole “FreeMarkerLoginFormsProvider” class content to mine LoginFormsProvider, and the same with “FreeMarkerLoginFormsProviderFactory”, it didn’t helped.

Once, during debugging it worked, my browser display error.ftl page instad of its source code. It happend when, durring jumping brom breakpoint to breakpoint i give up and stopped application/debuging in some where “half way” to moment when page is returned. And I get correct error page without program proceed to finish. So something is overiding my correct.ftl response? But what? And why?