Which tool versions are you using?
SDK: v14.21.0
Platform: v25.06.4
Python: v3.11
Isolation mode: venv
Current Behavior
I’m trying to show the user a warning, which shouldn’t forbid continuing the following steps.
Violations work as intended, but UserMessage.warning (/.info/.success) aren’t working. The message only appears in the terminal (when in dev mode), and not at all in the publication state.
Here’s a shortened version of what I’m attempting to do:
import viktor as vkt
def check_step1(params, **kwargs):
"""Warn if the toggle is On"""
violations = []
if params.step1.bool:
msg = "Toggle shouldn't be On"
# Record the violation
if True: # no impact on the user messages
violation = vkt.InputViolation(msg, fields=["step1.bool"])
print(msg)
violations.append(violation)
# User messages - NOT WORKING
vkt.UserMessage.info(f"INFO: {msg}")
vkt.UserMessage.warning(f"WARNING: {msg}")
vkt.UserMessage.success(f"SUCCESS: {msg}")
# Show the violations
if violations:
msgs = ". ".join([f"{v.message}. Fields: {v.fields}" for v in violations])
raise vkt.UserError(f"ERROR! {msgs}", input_violations=violations)
class Parametrization(vkt.Parametrization):
step1 = vkt.Step("Step1", on_next=check_step1)
step1.bool = vkt.BooleanField("Toggle", default=False)
step2 = vkt.Step("Step2")
step2.txt = vkt.Text("Welcome to step 2")
class Controller(vkt.Controller):
parametrization = Parametrization
Context
I want to use user messages because I have a case where a value x should be smaller than x_warn, and must be smaller than x_max (both bounds depend on multiple parameters and are calculated on_next). I therefore want to warn the user if they input x > x_warn, and forbid them from inputting x > x_max.
User messages are retrieved on a polling interval. My hypothesis is that the check_step1 method returns before that time. I think you are right to expect to see the message, so this is something we need to look into. Thanks for reporting.
1 Like
Thanks for your message Raoul.
Am I perhaps misunderstanding how user messages should be used? Should they be used at another stage than on next?
Hi Remi,
No you are not misunderstanding how they should be used. I’ll try to explain what the current behavior is; lets say the user messages are polled by the FE with a 1 second interval. If your on_next method returns within that second the message won’t be visible in the UI. I understand that this behavior is unexpected, so I think it is something that should be addressed on our side.
hi! I’m having a similar issue too that an UserMessage.Warning is not being shown because the method gets calculated quite quickly. I understand the issue but I think a solution is needed since it is important to still show the Warning to the user even after the method has finished.
for now i will just add a delay to make sure the user has time to read the message, are there any better solutions?
thanks!
I am also running into messages not showing up to the user, and would love a solution here. I am currently using userErrors to display success messages, which is not ideal!
Maybe there is some nuance I’m missing here, but my expectation would have been a popup or UI indication for the success.
Hi!
As far as I know, the way the UserMessage works is either:
- Slow/Long running view: the usermessage shows up in the progress message dialog box
- Quick/Short view, the usermessage shows up in the log of all jobs underneath this bell icon:

Does that match with what you see happening in your app?
Hi @cslotboomFE ,
As @rweigand pointed out, long-running calculations make the message visible to the user, and all user messages are logged behind the bell icon. Therefore, to show the message to the user, I would recommend adding a sleep method with a delay of a few seconds to allow the user to see the message.
Hi @rweigand and @mslootweg ,
Indeed you’re right, the user message appears in the job log. However the bell doesn’t change colors or anything that might tell the user to check it out. And without this it’s unlikely they would think to click on the bell and search through the different steps’ messages.
I wasn’t able to make the message appear as a pop up. I tried with adding delays before/after/both the message. 1 or 2 seconds delays = no pop up; 3sec = “Validation step has taken too long”.
I tried in dev and published modes. Here’s my app:
import time
import viktor as vkt
def check_step1(params, **kwargs):
time.sleep(1)
vkt.UserMessage.warning("some warning")
time.sleep(1)
class Parametrization(vkt.Parametrization):
step1 = vkt.Step("Step1", on_next=check_step1)
step1.txt = vkt.Text("Welcome to step 1")
step2 = vkt.Step("Step2")
step2.txt = vkt.Text("Welcome to step 2")
class Controller(vkt.Controller):
parametrization = Parametrization
@RemiPelletier just to be sure: Marcel’s suggestion is to add that sleep in combination with setting the view to be a “long” view, i.e. duration_guess=5 Is that also what you tried? Afaik there is indeed no clear way to have the bell icon change status or a popup, so this thread might also serve as a feature request, one I can definitely understand and get behind.
Hi @rweigand, isn’t duration_guess only available for PDF/Geometry/… views? What about for steps without a view?
Hi, so sorry, you are absolutely correct, I’d misread! duration_guess only applies to views, not steps