Field not working in script

I have an issue with the use of fields in a script. A test script I made is does not what I expected tot do:

alias: A new Script
fields:
  test_field:
    selector:
      number:
        min: 1
        max: 100
    name: Test field
    required: true
    default: 45
sequence:
  - service: logbook.log
    metadata: {}
    data:
      name: A log message
      message: Test field = '{{ test_field }}'
description: ""

Output in the log is:
Template variable warning: 'test_field' is undefined when rendering 'Test field = '{{ test_field }}''

I have specified a default value so I expected Test field = 45 as output.

Does anyone has a clue what is going on?

How do you call that script?

This script I call with Run from the three dots script menu.
I also tried a simular script called from an automation. In the visual editor the field shows as a setting. I entered a value, but when the automtion triggers, that value is not in the script.
The code in this post is a result of narrowing to the field issue.
IMHO this is a bug in HA core.

That doesn’t allow you to specify a value for the field, afaik. So It’s not defined in the script, hence the runtime error.

Please post that one, or rather a test automation calling the script above.
Or call the script through the “Services” debugging tool.

What happens when you run the script from Developer Tools → Services?

If I might add, i have the same “bug” that I would call a UI bug.
When there is a field, the modal windows should always open when using the command run. And also, I’ve put a “default” value that does not seem to be read 50% of the time.