I'm making a graphical modeler that creates me a kind of DSM, like that:

enter image description here

  1. I create a DEM for my extent (I have the DEM for my whole country).
  2. I have the Lidar for the height of the forest and I extract it for my extent.
  3. I also have a polygon that I rasterized. It is where the forest should be cut off (1/0 meaning yes/no).

As you can see, everything works fine. I have my raster layers (same CRS, same resolution, same extent).

enter image description here

Now, I want to do this in raster calculator:

enter image description here

So in words, it means if the forest is cut (No forest =1) then the value is DEM, and if the forest is not cut then the value is DEM+Lidar forest.

The problem is, I always have this error:

enter image description here

Impossible to load the source layer for INPUT_A: invalid value

Error during raster calculator execution

I use QGIS 3.22

But as you can see, my modeler produises the 3 rasters (temporary files) without any problem:

enter image description here

enter image description here

enter image description here

  • In error message, INPUT_A is empty. Maybe nothing returns from "No Forest" tool. Commented Mar 24, 2023 at 11:03
  • No, it is not that, cause as you can see the "No Forest" tool produces me a raster layer as expected.
    – katagena
    Commented Mar 26, 2023 at 17:34

2 Answers 2


It may be that the "No Forest" layer needs to be explicitly mentioned as a dependency in the Raster Calculator. This would make sure that "No Forest" gets created before the Raster Calculator runs.

(Your screenshot of the Raster Calculator cut off the Dependencies field, so I can't tell if it was already set.)

One would think that listing the "No Forest" layer in the algorithm inputs would create an implicit dependency...after all, the line from "No Forest" to the raster calculator appears in the model. But maybe a bug prevents the implicit dependency here.

I have run into situations where making an explicit dependency clears up a problem, even though it seems like it would not be necessary.


I have had times when referencing a temporary (aka "memory") raster layer causes problems in the modeler. Try specifying a file on disk for the "No Forest" output when you run the model. That may help the raster calculator find the missing input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.