How to fix a broken Processing model with AttributeError: ‘NoneType’ object has no attribute ‘getCopy’

Broken Processing models are nasty and this error is particularly unpleasant:

File "/home/agraser/.qgis2/python/plugins/processing/modeler/", line 110, in algorithm
self._algInstance = ModelerUtils.getAlgorithm(self.consoleName).getCopy()
AttributeError: 'NoneType' object has no attribute 'getCopy'

It shows up if you are trying to open a model in the model editor that contains an algorithm which Processing cannot find.

For example, when I upgraded to Ubuntu 16.04, installing a fresh QGIS version did not automatically install SAGA. Therefore, any model with a dependency on SAGA was broken with the above error message. Installing SAGA and restarting QGIS solves the issue.

  1. Jordan W Brod said:

    I still find the dependency missing message to be incredibly frustrating. Usually means a binge of installs and uninstalls and crossing my fingers and sacrificing to the geography gods to get GRASS working. This is a great thought for us Ubuntu users to remember though.

  2. Alister Hood said:

    A pity the error isn’t caught, to give the user a sensible message. If you actually try running the model rather than editing it, you’ll get something much more informative – in my case:

    Error executing algorithm
    This algorithm cannot be run 😦
    The model you are trying to run contains an algorithm that is not available: saga:catchmentarea

    Next issue in my case: there is a saga catchment area algorithm, and it is working. So what is the model doing wrong?

    This was my first time using a processing model, so I had to do a couple of things:

    1. Figure out where the model is stored so I can open it in a text editor. I forget how I did this, but I later saw that when I go to “save as” a model (see 2 below) it defaults to the location where it is (although that won’t help you determine which file it is in if you have several models).

    2. Use the “Processing modeller” to create a new model which runs the saga catchment area algorithm. “Save as” and open that in the text editor too.

    Searching for “saga:catchmentarea” in the broken model I find this section:

    “consoleName”: “saga:catchmentarea”,
    “description”: “Catchment Area”

    The similar section in my new working model is this:
    “consoleName”: “saga:flowaccumulationtopdown”,
    “description”: “Catchment area”

    So, I guess the saga command has been renamed or obsoleted, and I need to use the flowaccumulationtopdown algorithm now…
    The qgis docs ( suggest that yes, this is the same algorithm, so although I guess I should check some saga docs to see e.g. that the inputs are the same, I will try just renaming it in the model file.

    After saving the file I unsuccessfully try to edit the model in qgis again. Trying to run the model gives the same error message, so I restart qgis, and it works!

%d bloggers like this: