List(node.res) does not work

Hi, I am trying to following the tutorials in this webpage

I chose the calculation node 17

:~/AiiDA$ verdi node show 17
Property     Value
-----------  ------------------------------------
type         ArithmeticAddCalculation
state        Finished [0]
pk           17
uuid         85fa0592-4b31-4b78-b98b-23e929d4e995
ctime        2024-01-25 23:03:07.728132+08:00
mtime        2024-01-25 23:03:08.266182+08:00
computer     [1] tutor

Inputs      PK  Type
--------  ----  -------------
code         5  InstalledCode
x           16  Int
y           13  Int

Outputs          PK  Type
-------------  ----  ----------
remote_folder    18  RemoteData
retrieved        19  FolderData
sum              20  Int

Caller      PK  Type
--------  ----  --------------------
CALL        14  MultiplyAddWorkChain
(aiida) yang@yang-Inspiron-3670:~/AiiDA$ 

node.res works , but list(node.res) does not.

n [82]: node= orm.load_node(pk=17)

In [83]: list(node.res)
ValueError                                Traceback (most recent call last)
Cell In[83], line 1
----> 1 list(node.res)

File ~/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/orm/utils/, in CalcJobResultManager.__iter__(self)
     86 def __iter__(self):
     87     """Return an iterator over the keys of the result dictionary."""
---> 88     for key in self.get_results().keys():
     89         yield key

File ~/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/orm/utils/, in CalcJobResultManager.get_results(self)
     72 """Return the results dictionary of the default results node of the calculation node.
     74 This property will lazily load the dictionary.
     76 :return: the dictionary of the default result node
     77 """
     78 if self._results is None:
---> 79     self._load_results()
     80 return self._results

File ~/miniforge3/envs/aiida/lib/python3.11/site-packages/aiida/orm/utils/, in CalcJobResultManager._load_results(self)
     58 default_output_node_label = process_spec.default_output_node
     60 if default_output_node_label is None:
---> 61     raise ValueError(f'cannot load results as {process_class} does not specify a default output node')
     63 try:
     64     default_output_node = self.node.base.links.get_outgoing().get_node_by_label(default_output_node_label)

ValueError: cannot load results as <class 'aiida.calculations.arithmetic.add.ArithmeticAddCalculation'> does not specify a default output node

In [84]: node.res
Out[84]: <aiida.orm.utils.calcjob.CalcJobResultManager at 0x7ffa885c4d90>

Similar situation happens for node pk=3 and so on.
What is the problem?
Many thanks!

Dr. Guoyu Yang
Jimei Univ, School of Science, Digital Fujian Big Data Modeling and Intelligent Computing Institute
185 Yinjiang Rd.,
Jimei District, Xiamen,361021
Fujian, China

Hi @AmberLEE123456, thanks for the question.

The exception message “ValueError: cannot load results as <class ‘aiida.calculations.arithmetic.add.ArithmeticAddCalculation’> does not specify a default output node” explain the error comes from that the ArithmeticAddCalculation does not have a output node set as default.

In the documentation it says

CalcJobNode’s provide the res() property, that can give easy access to the results of the calculation job. The requirement is that the CalcJob class that produced the node, defines a default output node in its spec."

So in order to use list(node.res), you need to define output_default_node for the calcjob as given in TemplatereplacerCalculation plugin

    def define(cls, spec):

        spec.output('output_parameters', valid_type=orm.Dict, required=True)
        spec.default_output_node = 'output_parameters'

We’ll try to improve the documentation with the example in text.