acton icon indicating copy to clipboard operation
acton copied to clipboard

Error message missing correct source location

Open klambrec opened this issue 4 months ago • 1 comments

Acton Version

0.26.0.20250829.1.52.47

Steps to Reproduce and Observed Behavior

Error received:

  Compiling sorespo/rfs.act with Debug
[error]: Constraint violation
     ╭──▶ @0:0-0:0
     │
   0 │ <no line>
     •
     • ╰╸ ?_ must be a subclass of __builtin__.str
─────╯

Through trial and error I found out it was in this block of code:

        if not protocols_enabled:
            if_input = crpd23.junos_rpc_interfaces__get_interface_information__input()
            if_input.interface_name = interface_name
            if_input.level = "statistics"
            rpc_root.get_interface_information(on_if_stats_response, if_input)

And the fix was to None check the interface_name:

        if interface_name is not None and not protocols_enabled:
            if_input = crpd23.junos_rpc_interfaces__get_interface_information__input()
            if_input.interface_name = interface_name
            if_input.level = "statistics"
            rpc_root.get_interface_information(on_if_stats_response, if_input)

If more context is required, have a look at https://github.com/orchestron-orchestrator/sorespo/pull/166

Expected Behavior

I have no idea if reporting this is fair/useful but I hit this the other day and it certainly felt like the compiler could have helped me more here than it did ?

klambrec avatar Sep 01 '25 20:09 klambrec

@klambrec all error messages should have a source location (0,0 is not a valid source location). We can talk about just how accurate it should be / point to, but at least it must be better than this, so this is definitely a bug and you are doing the right thing in reporting it!

It's preferably to find small reproductions, but it's OK to just point to sorespo code like you did here.

plajjan avatar Sep 02 '25 08:09 plajjan