This forum is shutting down! Please post new discussions at

Error encountered:Line contains NULL byte


I am trying to run the carbon sequestration model and I keep getting the

error encountered: line contains NULL byte message

what does this mean ?



  • swolnyswolny Member, NatCap Staff
    Hi @hildegaardl -

    Which version of InVEST are you running? 

    To help us troubleshoot, it's always useful for you to post your whole logfile that's generated when the model is run, then we can see where your error is happening - thanks!

    Offhand, I wonder if you have a blank line at the bottom of your carbon pool .csv file. If that's the case, try deleting it and rerunning. I might be able to help more after seeing the logfile.

    ~ Stacie

  • Hi ,

    I got a chance to look at your excellent tutorial on
    carbon sequestration this morning. I managed to generate a couple of maps
    making sure that my carbon pool table was in CSV format. Yay ! the most recent
    data run produced a map but had one error message. The run log is attached and
    below. It looks as though there is  a
    problem with my "c_above" column My carbon pool csv is also attached.

    Can you help me figure out where I have goofed ?


    Is it possible to get an error message that is trivial to
    the value of the output ? kind of like your oil light is on but when you look
    at the dipstick your oil reservoir is full ?




    12/29/2017 19:42:20 
    natcap.invest.utils INFO    
    Writing log messages to C:\Users\Hildegaard\OneDrive\Dissertation\Q2
    modeling,data,maps\NYS watershed data\InVEST-InVEST-Carbon-Model-log-2017-12-29--19_42_20.txt

    12/29/2017 19:42:20 
    natcap.invest.ui.model Level 100 Starting model with parameters:

    Arguments for InVEST natcap.invest.carbon 3.4.0:

    calc_sequestration False




    C:/Users/Hildegaard/OneDrive/Dissertation/Q2 modeling,data,maps/NYS
    watershed data/NYCwatershedscratch/nycwat4ershedprorasclip.tif


    C:\Users\Hildegaard\OneDrive\Dissertation\Q2 modeling,data,maps\NYS
    watershed data


    12/29/2017 19:42:20 
    natcap.invest.carbon INFO    
    Building file registry

    12/29/2017 19:42:21 
    natcap.invest.carbon INFO     Map
    all carbon pools to carbon storage rasters.

    12/29/2017 19:42:21 
    natcap.invest.ui.model ERROR   
    Exception while executing <function execute at 0x0E510570>

    Traceback (most recent call last):

    line 1496, in _logged_target

    line 151, in execute

    KeyError: 'c_above'

    12/29/2017 19:42:21 
    natcap.invest.ui.model INFO    
    Execution finished

    12/29/2017 19:42:21 
    natcap.invest.utils INFO    
    Elapsed time: 1.0s

    is the Log file
  • swolnyswolny Member, NatCap Staff
    edited December 2017
    Hi Hildegaard -

    I see that you're running InVEST 3.4.0. Would you mind trying the latest (3.4.2) and see if it still happens? Several bugs were fixed between these versions, I'm not sure if this is one, but let's just make sure. 

    Also, I don't see the carbon pool table attached - please try again - thanks!

    ~ Stacie

    Post edited by swolny on
  • HI thanks for your response, I tried to up load my carbon pol csv and the tool says uploaded file type is not allowed ? Grrrr


  • swolnyswolny Member, NatCap Staff
    Shoot, that's right, and unfortunate. You can send it directly to me - swolny at

    Or, you could have the carbon model app bundle up your data and send me the whole thing so I can try reproducing the error. Go to File -> Save as, then Datastack type "data archive". This is a new feature in InVEST 3.4 that it would be great to try out.

    ~ Stacie

  • swolnyswolny Member, NatCap Staff
    Thanks for sending me the data, Hildegaard. When I ran it on InVEST 3.4.2, I got the same error that you did. Everything looked ok in your carbon pool table, but Excel seemed to think that it was a "unicode .txt" file and not CSV. So I didn't change anything in the table, just re-saved as a "CSV comma-delimited" and no error.

    However, I did get a different error, indicating that there is a Value of 420 in your LULC raster that does not have a corresponding value in the carbon pool table. And sure enough, lucode 420 is missing in the .csv. So try changing the table format, and add a value for 420 to the .csv and see if that helps.

    ~ Stacie

  • RichRich Administrator, NatCap Staff
    Hi @hildegaardl, I took a look at your data and your CSV table is saved in a unicode format. For some complicated back end issues, InVEST handles unicode csv tables poorly due to the backend Python 2.7 implementation. We're moving towards Python 3 where this will be fixed, but that will take some time. In the meanwhile, I've resaved your carbon pool table in pure ASCII and it works on my end. I hope this temporarily fixes your issue and for folks who might run across this in the future you can do the same by saving your table in excel as a "CSV (MS-DOS) (*.csv)" type.  *NOT* "CSV UTF-8".

    Here your converted table if you'd like to use it directly:
Sign In or Register to comment.