# Coastal Vulnerability: AttributeError: 'NoneType' object has no attribute 'IsValid'

**URL:** <https://community.naturalcapitalalliance.org/t/coastal-vulnerability-attributeerror-nonetype-object-has-no-attribute-isvalid/3389>\
**Category:** Software Support\
**Tags:** coastal-vulnerability\
**Created:** [February 3, 2023, 6:58am UTC](https://community.naturalcapitalalliance.org/t/coastal-vulnerability-attributeerror-nonetype-object-has-no-attribute-isvalid/3389 "2023-02-03T06:58:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iKonig](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@iKonig](https://community.naturalcapitalalliance.org/u/iKonig)\
**Post date:** [February 3, 2023, 6:58am UTC](https://community.naturalcapitalalliance.org/t/coastal-vulnerability-attributeerror-nonetype-object-has-no-attribute-isvalid/3389/1 "2023-02-03T06:58:54Z")

</div>

Hi all!

I’ve been trying to use the Coastal Vulnerability model but currently faced with this error: AttributeError: ‘NoneType’ object has no attribute ‘IsValid’. Seems to be the one of my vectors (Mangrove) but I am not entirely sure.

Here are the data: [https://drive.google.com/drive/folders/1J96f\_No\_dfvuUu8pJgbFiZIJ8lcL6JOi?usp=share\_link](https://drive.google.com/drive/folders/1J96f_No_dfvuUu8pJgbFiZIJ8lcL6JOi?usp=share_link)

Appreciate all feedbacks and help.

Thank you!

### Attach the logfile here:

[InVEST-natcap.invest.coastal\_vulnerability-log-2023-02-03–13\_12\_39.txt](https://community.naturalcapitalalliance.org/uploads/short-url/uFxYzzJKCSLg2OWYURDBFDI7x7P.txt) (3.1 KB)

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [February 3, 2023, 4:14pm UTC](https://community.naturalcapitalalliance.org/t/coastal-vulnerability-attributeerror-nonetype-object-has-no-attribute-isvalid/3389/2 "2023-02-03T16:14:42Z")

</div>

Welcome to the forum, @iKonig!

Thanks for posting the log file and data. If you look earlier in the log file, there’s this message:

```auto
2023-02-03 13:12:39,623 (natcap.invest.coastal_vulnerability) coastal_vulnerability.search_for_vector_habitat(2048) INFO Searching for Mangrove within 500 meters of shore points
2023-02-03 13:12:39,702 (taskgraph.Task) Task.add_task(706) ERROR Something went wrong when adding task searching for Mangrove

```

So I’m guessing that the issue is that the model is not finding any Mangrove within 500 meters of your landmass. And when I look at your inputs, indeed that seems to be the case. You have a lot of polygons in your landmass, and a lot of Mangroves, but your area of interest polygon only covers a very small area, and there are no Mangroves anywhere near it.

~ Stacie

---

<div class="post-metadata">

**Author:** ![iKonig](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@iKonig](https://community.naturalcapitalalliance.org/u/iKonig)\
**Post date:** [February 3, 2023, 5:39pm UTC](https://community.naturalcapitalalliance.org/t/coastal-vulnerability-attributeerror-nonetype-object-has-no-attribute-isvalid/3389/3 "2023-02-03T17:39:27Z")

</div>

Ah, I thought so! Thank you very much @swolny for your time and effort to check. Also, if that’s the case, what do you recommend to do in this case? Do I have to make the value lower?

Really appreciate your help. Thanks!

---

<div class="post-metadata">

**Author:** ![dave](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/dave/32/70_2.png) [@dave](https://community.naturalcapitalalliance.org/u/dave)\
**Post date:** [February 3, 2023, 6:15pm UTC](https://community.naturalcapitalalliance.org/t/coastal-vulnerability-attributeerror-nonetype-object-has-no-attribute-isvalid/3389/4 "2023-02-03T18:15:40Z")

</div>

> [@swolny](#):
>
> your area of interest polygon only covers a very small area, and there are no Mangroves anywhere near it.

This is indeed a problem! Though technically the model hit this error before it finished searching for the Mangroves. I think the error is caused by an empty feature in the Mangrove layer. In other words, there is a row in the attribute table that has no associated polygon. Deleting that feature should resolve this.

---

<div class="post-metadata">

**Author:** ![iKonig](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@iKonig](https://community.naturalcapitalalliance.org/u/iKonig)\
**Post date:** [February 6, 2023, 8:56am UTC](https://community.naturalcapitalalliance.org/t/coastal-vulnerability-attributeerror-nonetype-object-has-no-attribute-isvalid/3389/5 "2023-02-06T08:56:20Z")

</div>

> [@dave](#):
>
> Deleting that feature should resolve this.

Thank you for your comment! You’re right, I deleted some of the empty features and it works perfectly now.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/8/8d95591aa074da87ea0fdd61ca47c1c3c0588aa7.png) [@system](https://community.naturalcapitalalliance.org/u/system)\
**Post date:** [February 13, 2023, 8:56am UTC](https://community.naturalcapitalalliance.org/t/coastal-vulnerability-attributeerror-nonetype-object-has-no-attribute-isvalid/3389/6 "2023-02-13T08:56:55Z")

</div>

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