Showing results for 
Search instead for 
Did you mean: 

ncs.maagic.MaagicError: Missing key argument in create

Tomoya Watanabe


We are evaluating NSO version UP from 4.7.1 to

An Action point worked in 4.7.1 is not working after upgrade to as below:



<INFO> 13-Sep-2023::15:42:08.570 foo ncs-dp-385541-foo:main:0-4-usid-216-foo-show-alarms: - Action called (service=/foo:action)
<INFO> 13-Sep-2023::15:42:08.570 foo ncs-dp-385541-foo:main:0-4-usid-216-foo-show-alarms: - Action name: show-alarms
<INFO> 13-Sep-2023::15:42:08.570 foo ncs-dp-385541-foo:main:0-4-usid-216-foo-show-alarms: - Action input.device: bar
<ERROR> 13-Sep-2023::15:42:09.863 foo ncs-dp-385541-foo:main:0-4-usid-216-foo-show-alarms: - Missing key argument in create
<ERROR> 13-Sep-2023::15:42:09.865 foo ncs-dp-385541-foo:main:0-4-usid-216-foo-show-alarms: - Traceback (most recent call last):
  File "/opt/ncs/ncs-", line 665, in wrapper
   ret = fn(self, uinfo, str(name), kp, input, output, act_trans)
  File "/opt/ncs/ncs-", line 626, in fn2
    return ofn(self, uinfo, name, kp, input, output)
  File "/var/opt/ncs/state/packages-in-use/1/foo/python/foo/", line 30, in cb_action
    alarms_device.validate(output, self.log)
  File "/var/opt/ncs/state/packages-in-use/1/foo/python/foo/", line 52, in validate
    if not alarm.validate(maagic_node.alarms.create()):
  File "/opt/ncs/ncs-", line 1236, in create
    raise MaagicError("Missing key argument in create")
ncs.maagic.MaagicError: Missing key argument in create



It looks like related to ENG-18102

Using Maagic to create a keyed list entry in an input or output section of an action now need the key(s) to be specified in the create() call. [ENG-18102/python-api non-backwards compatible correction]

However, we have no idea whether this error came from this ENG and how we can fix it.

Does anyone hove information?

2 Replies 2



You are calling create function with no arg , you need to pass an arg otherwise it won't work.

Here  an example 

----> 1 root.devices.device.create()

File ~/ncs-5.8.10/src/ncs/pyapi/ncs/, in List.create(self, *keys)
   1293     keys = maapi.Key(len(self))
   1294 elif len(keys) == 0:
-> 1295     raise MaagicError("Missing key argument in create")
   1296 elif len(keys) == 1:
   1297     keys = maapi.Key(keys[0])

MaagicError: Missing key argument in create

In [14]: root.devices.device.create("test")
Out[14]: ListElement name=device tag=617911018 keys={test}

Cisco Employee
Cisco Employee

Is "maagic_node.alarms" representing a list node(with key) in the model? If so, ENG-18102 introduced a non-backwards-compatible change from 5.1 which prohibits list(with key) creation without a key, and the fix is either passing a key to create() call or changing the model to use a keyless list.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: