Hi Martin,
In my understanding, when you have enabled the auto-bind for the VLAN data under an STP domain, STP is going to protect only this VLAN. So, if you are enabling edge-safeguard configuration globally for a port, we need to ensure that the port is a part of a VLAN which is protected by STP.
Looking at the outputs above, it seems like the ports 1 and 2 are not part of the data-vlan and hence the error.
If we have multiple VLANs protected under the STP domain, the port has to be a part of atleast one of these VLANs before you can enable edge-safeguard configuration.
Lab configuration:
create stpd STP-DATA
configure stpd STP-DATA mode dot1w
enable stpd STP-DATA rapid-root-failover
configure stpd STP-DATA default-encapsulation dot1d
enable stpd STP-DATA auto-bind vlan Data
enable stpd STP-DATA auto-bind vlan data2
configure stpd STP-DATA ports mode dot1d 1:2
configure stpd STP-DATA ports port-priority 128 1:2
configure stpd STP-DATA ports edge-safeguard enable 1:2
enable stpd STP-DATA ports 1:2
configure stpd STP-DATA ports mode dot1d 1:3
configure stpd STP-DATA ports port-priority 128 1:3
configure stpd STP-DATA ports edge-safeguard enable 1:3
enable stpd STP-DATA ports 1:3
1:3 untagged in vlan data
1:2 untagged in vlan data2.
So, this looks like how it should behave and I think you are doing it right except that while executing the command, we need to ensure that the ports are part of the VLAN protected by this STP domain.
Is there a specific reason why you are looking to enable edge safeguard on a port which is not a part of VLAN protected by the corresponding STP domain?
Hope this helps!