Automation fails to copy value from one input_number to another

HA in HAOS mode release 2024.9.1

This automation is intended to copy the number from input_number.n1 to input_number.n2 when the number in the first entity changes:

alias: n1 to n2
description: ""
trigger:
  - platform: state
    entity_id:
      - input_number.n1
condition: []
action:
  - action: number.set_value
    data:
      value: "{{ states('input_number.n1') }}"
    target:
      entity_id: input_number.n2
mode: single

After I edit the number in the first input_number, the automation runs and the trace looks as I’d expect, e.g.

alias: n1 to n2
description: ""
trigger:
  - platform: state
    entity_id:
      - input_number.n1
condition: []
action:
  - action: number.set_value
    data:
      value: "{{ states('input_number.n1') }}"
    target:
      entity_id: input_number.n2
mode: single

However I get an error in the HA log:

Referenced entities input_number.n2 are missing or not currently available

A far as I can see it is “available” though and when I execute this action in developer tools

action: input_number.set_value
target:
  entity_id: input_number.n2
data: 
  value: "{{ states('input_number.n1')}}"
  

the number is copied correctly and appears in the dashboard in input_number 2.

What am I doing wrong?

This is the wrong service:

You do not have number entities, you have input_number entities. Use the input_number.set_value service.

Of course … thank you, I just couldn’t see that.