Does your error message show $did or /did ? There's a difference.
The $did error comes from evaluating the if() portion, and would also happen if the dialog were already open and tried to do

//echo -a $did(name,50)

while identifier warning was enabled in scripts-editor/options. If you need to quickly check whether you've used a number already:
//echo -a $did(name,50).isid