Seasonal Water Yield: Key Error

InVEST-Seasonal-Water-Yield-log-2021-08-12–18_29_10.txt (4.3 KB)

Hi Everyone,
I am having an issue with “Key Error: 127” when running the Seasonal Water Yield Model
Looking through the log, the errors seem to be described as:

“2021-08-12 18:48:08,961 WARNING No valid pixels were received, sending None.
2021-08-12 18:48:08,962 Task.add_task(781) ERROR Something went wrong when adding task calculate curve number (13), terminating taskgraph.”


“KeyError: 127
2021-08-12 18:48:08,963 model._logged_target(1652) ERROR Exception while executing <function execute at 0x00000214B77A0CA8>”

Any help would be appreciated.


Hi @AndrewG, thanks for posting to the forums.

It looks like this could be coming from the soil group raster. Could you check that your soil group raster has only the values 1, 2, 3, 4?



Hi @dcdenu4
All of the values are either 2 or 3, however in the original data set there were values of 13, but these were reclassified to 3.
There is also an area of open water, but when I filled that in with data I got a similar result, but with Key Error: 0 this time.

InVEST-Seasonal-Water-Yield-log-2021-08-13–11_06_53.txt (7.8 KB)

I will also attach my reclassified soil raster to this message so someone can spot any issues there might be with it.

Extract_Recl1.tif (35.2 KB)

Thanks for your help so far,


Hi @AndrewG ,

Looking at the raster you sent it appears that the nodata value is not defined, so the 0 value is being included along with the acceptable 1, 2, 3, 4 values.

Could you try using QGIS to set the nodata value for the raster? You can do so with the Translate tool (Raster -> Conversion -> Translate):

The above will set the nodata value to 9. Then to convert the 0 values to nodata you can right click the raster and Export -> Save As

Setting that nodata range from 0 to 0 will make the 0 values `nodata.

Hopefully this helps.


1 Like

Hi @dcdenu4

It worked and I now have the model running successfully, thanks for all of your help!



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.