InVEST model execute functions return a dictionary representing the file registry. This is used in metadata generation and in reports. But if a plugin does not return anything from execute, we should tolerate this. Right now it results in a warning, which includes a caught exception,
2026-04-20 14:02:52 natcap.invest.spec WARNING Something went wrong while generating metadata
Traceback (most recent call last):
File "/Users/<>/Library/Application Support/invest-workbench/micromamba_envs/plugin_1776689697943/lib/python3.13/site-packages/natcap/invest/spec.py", line 2260, in execute
self.generate_metadata_for_outputs(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
registry, preprocessed_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/<>/Library/Application Support/invest-workbench/micromamba_envs/plugin_1776689697943/lib/python3.13/site-packages/natcap/invest/spec.py", line 2115, in generate_metadata_for_outputs
for key, value in file_registry.items():
^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'items'
This is a bit heavy-handed. It's okay for plugins to return None from execute so we shouldn't issue a message that makes people think something went wrong.
Benefits
The bar to getting a plugin working will be lowered because developers will not necessarily need to create an output specification or use a file_registry object before getting a functional plugin.
Mitigation of side effects
Fewer developers may opt in to using these features (file_registry and metadata) which is not a good thing. We can provide documentation and examples of plugins that do use these features in order to encourage these practices.
InVEST model
executefunctions return a dictionary representing the file registry. This is used in metadata generation and in reports. But if a plugin does not return anything fromexecute, we should tolerate this. Right now it results in a warning, which includes a caught exception,This is a bit heavy-handed. It's okay for plugins to return
Nonefromexecuteso we shouldn't issue a message that makes people think something went wrong.Benefits
The bar to getting a plugin working will be lowered because developers will not necessarily need to create an output specification or use a
file_registryobject before getting a functional plugin.Mitigation of side effects
Fewer developers may opt in to using these features (file_registry and metadata) which is not a good thing. We can provide documentation and examples of plugins that do use these features in order to encourage these practices.