ZWave JS: Cannot set usercode

Using ZWave JS integration (switched from deprecated ZWave integration) for a Yale door lock.
Having trouble setting usercodes on both Scripts and through Services.
Script as below

set_front_door_usercode:
  alias: Set Random Usercode
  icon: mdi:key
  mode: single
  sequence:
  - data_template:
      entity_id: input_number.guest_code
      value: '{{ states.sensor.first_set.state | int }}{{ states.sensor.second_set.state
        | int }}{{ states.sensor.third_set.state | int }}'
    service: input_number.set_value
  - service: zwave_js.set_lock_usercode
    target:
      entity_id: lock.front_door_lock
    data:
      code_slot: '5'
      usercode: '{{ states.input_number.guest_code.state | int }}'

Error logs:

[548038229536] Error handling message: Unknown error
[547894828720] userCode for code slot 5 not found
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 21, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 482, in handle_execute_script
    await script_obj.async_run(msg.get("variables"), context=context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1209, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 345, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 563, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1481, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1516, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 630, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 726, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/zwave_js/lock.py", line 127, in async_set_lock_usercode
    await set_usercode(self.info.node, code_slot, usercode)
  File "/usr/local/lib/python3.8/site-packages/zwave_js_server/util/lock.py", line 89, in set_usercode
    value = get_code_slot_value(node, code_slot, LOCK_USERCODE_PROPERTY)
  File "/usr/local/lib/python3.8/site-packages/zwave_js_server/util/lock.py", line 32, in get_code_slot_value
    raise NotFoundError(f"{property_name} for code slot {code_slot} not found")
zwave_js_server.exceptions.NotFoundError: userCode for code slot 5 not found

Same here with a Allegion BE469ZP.

service: zwave_js.set_lock_usercode
target:
  entity_id: lock.cerradura
data:
  code_slot: '3'
  usercode: '777777'


The error:

Logger: homeassistant.helpers.script.websocket_api_script
Source: components/zwave_js/lock.py:129
First occurred: 09:59:44 (1 occurrences)
Last logged: 09:59:44

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: userCode for code slot 3 not found
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 811, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/zwave_js/lock.py", line 129, in async_set_lock_usercode
    await set_usercode(self.info.node, code_slot, usercode)
  File "/usr/local/lib/python3.9/site-packages/zwave_js_server/util/lock.py", line 89, in set_usercode
    value = get_code_slot_value(node, code_slot, LOCK_USERCODE_PROPERTY)
  File "/usr/local/lib/python3.9/site-packages/zwave_js_server/util/lock.py", line 32, in get_code_slot_value
    raise NotFoundError(f"{property_name} for code slot {code_slot} not found")
zwave_js_server.exceptions.NotFoundError: userCode for code slot 3 not found
Logger: homeassistant.components.websocket_api.http.connection
Source: components/zwave_js/lock.py:129
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 09:59:44 (1 occurrences)
Last logged: 09:59:44

[140390634834960] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 25, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 525, in handle_execute_script
    await script_obj.async_run(msg.get("variables"), context=context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1219, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 353, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 666, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 811, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/zwave_js/lock.py", line 129, in async_set_lock_usercode
    await set_usercode(self.info.node, code_slot, usercode)
  File "/usr/local/lib/python3.9/site-packages/zwave_js_server/util/lock.py", line 89, in set_usercode
    value = get_code_slot_value(node, code_slot, LOCK_USERCODE_PROPERTY)
  File "/usr/local/lib/python3.9/site-packages/zwave_js_server/util/lock.py", line 32, in get_code_slot_value
    raise NotFoundError(f"{property_name} for code slot {code_slot} not found")
zwave_js_server.exceptions.NotFoundError: userCode for code slot 3 not found

This is because the design of these Z-Wave door lock devices. The door locks need to stay very close to the controller at the moment of pairing. I was try several times pairing the lock with the controller 3.5 meters away from the lock and was very hard to include it (without line of sight and a few wood obstacles). I used a USB extension to bring the Z-Wave dongle closer to the lock and it worked fine, after pairing it again. After that, the zwave_js.set_lock_usercode service works fine.