# List(node.res) does not work

**URL:** <https://aiida.discourse.group/t/list-node-res-does-not-work/230>\
**Category:** New to AiiDA\
**Created:** [January 26, 2024, 11:09am UTC](https://aiida.discourse.group/t/list-node-res-does-not-work/230 "2024-01-26T11:09:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmberLEE123456](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/amberlee123456/32/51_2.png) [@AmberLEE123456](https://aiida.discourse.group/u/AmberLEE123456)\
**Post date:** [January 26, 2024, 11:09am UTC](https://aiida.discourse.group/t/list-node-res-does-not-work/230/1 "2024-01-26T11:09:09Z")

</div>

Hi, I am trying to following the tutorials in this webpage  
[https://aiida.readthedocs.io/projects/aiida-core/en/latest/howto/query.html#how-to-query](https://aiida.readthedocs.io/projects/aiida-core/en/latest/howto/query.html#how-to-query)

I chose the calculation node 17

```auto
:~/AiiDA$ verdi node show 17
Property Value
----------- ------------------------------------
type ArithmeticAddCalculation
state Finished [0]
pk 17
uuid 85fa0592-4b31-4b78-b98b-23e929d4e995
label
description
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.

```auto
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/calcjob.py:88, 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/calcjob.py:79, in CalcJobResultManager.get_results(self)
     72 """Return the results dictionary of the default results node of the calculation node.
     73 
     74 This property will lazily load the dictionary.
     75 
     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/calcjob.py:61, 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!

Sincerely,  
Dr. Guoyu Yang  
Lecturer  
Jimei Univ, School of Science, Digital Fujian Big Data Modeling and Intelligent Computing Institute  
185 Yinjiang Rd.,  
Jimei District, Xiamen,361021  
Fujian, China  
E-mail: [201961000100@jmu.edu.cn](mailto:201961000100@jmu.edu.cn)

---

<div class="post-metadata">

**Author:** ![jusong.yu](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/jusong.yu/32/3_2.png) [@jusong.yu](https://aiida.discourse.group/u/jusong.yu)\
**Post date:** [January 29, 2024, 12:46am UTC](https://aiida.discourse.group/t/list-node-res-does-not-work/230/2 "2024-01-29T00:46:35Z")

</div>

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`](https://aiida.readthedocs.io/projects/aiida-core/en/latest/reference/apidoc/aiida.orm.nodes.process.calculation.html#aiida.orm.nodes.process.calculation.calcjob.CalcJobNode)’s provide the [`res()`](https://aiida.readthedocs.io/projects/aiida-core/en/latest/reference/apidoc/aiida.orm.nodes.process.calculation.html#aiida.orm.nodes.process.calculation.calcjob.CalcJobNode.res) property, that can give easy access to the results of the calculation job. The requirement is that the [`CalcJob`](https://aiida.readthedocs.io/projects/aiida-core/en/latest/reference/apidoc/aiida.engine.processes.calcjobs.html#aiida.engine.processes.calcjobs.calcjob.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`](https://aiida.readthedocs.io/projects/aiida-core/en/latest/reference/apidoc/aiida.calculations.html#aiida.calculations.templatereplacer.TemplatereplacerCalculation) plugin

```python
    @classmethod
    def define(cls, spec):
        super().define(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.
