I get this error on both 2.10 & 2.12 on two different machines running Ubuntu 14.04 with Python 2.7.6.

When trying to run the fixed-distance buffer on a shapefile with polylines I get the following error:

QgsFeature.setGeometry(QgsGeometry): argument 1 has unexpected type 'NoneType' See log for more details

With full trace-back:

Uncaught error while executing algorithm
Traceback (most recent call last):
Traceback (most recent call last):|  
File "/usr/share/qgis/python/plugins/processing/core/GeoAlgorithm.py", line 230, in execute|
File "/usr/share/qgis/python/plugins/processing/algs/qgis/FixedDistanceBuffer.py", line 72, in processAlgorithm|
dissolve, segments)|
File "/usr/share/qgis/python/plugins/processing/algs/qgis/Buffer.py", line 81, in buffering|    outFeat.setGeometry(outGeom)|TypeError: QgsFeature.setGeometry(QgsGeometry): argument 1 has unexpected type 'NoneType'|

The first time I opened the "Processing" log to see more about this error, I noticed a problem with the SAGA installation but fixing that doesn't seem to solve this problem.

  • Try to print objects as thay are passed to QgsFeature.setGeometry(QgsGeometry) to find out what causes that error. Commented Nov 24, 2015 at 19:46
  • Tell me more, how do I go about this?
    – raphael
    Commented Nov 24, 2015 at 19:49
  • Maybe @SS_Rebelious was thinking to insert a line like print(outGeom.exportToWkt()) in your script before the problematic line and so you can see more easily what specific feature/geometry caused the problem. Anyway, seen your error message, and as @Jan Šimbera suggested, it looks like an empty geometry / like if your object outGeom isn't a QgsGeometry but just contain a None (which could result from a previous processing which haven't yield a geometry for this feature). Sorry, many speculations in my comment !
    – mgc
    Commented Nov 24, 2015 at 22:02

1 Answer 1


I guess you have a feature with empty geometry in the input shapefile. This answer provides a way to get rid of them.

  • 1
    Just a thought, but about the answer you suggested (gis.stackexchange.com/a/74558/53915), if the layer has many features and not so many empty geometry i guess it may could be less costly to put the problematic line (like outFeat.setGeometry(outGeom) for the OP) between a try - except statement like try: outFeat.setGeometry(outGeom) except TypeError: pass than testing each geometry against a if condition.
    – mgc
    Commented Nov 24, 2015 at 22:19
  • 1
    I provided an alternate answer to that question, since it seems one of the things the original asker tried now works in 2.12. It is possible to use the Select by expression function to select null geometries.
    – raphael
    Commented Nov 24, 2015 at 22:28

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.