# Structured Text Error

**URL:** <https://community.prismic.io/t/structured-text-error/1036>\
**Category:** Prismic for Content Creators\
**Created:** [June 29, 2020, 8:13pm UTC](https://community.prismic.io/t/structured-text-error/1036 "2020-06-29T20:13:11Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tim/32/8921_2.png) [@tim](https://community.prismic.io/u/tim)\
**Post date:** [June 29, 2020, 8:13pm UTC](https://community.prismic.io/t/structured-text-error/1036/1 "2020-06-29T20:13:11Z")

</div>

If you add text inside of a Structured Text field, save the document, then delete all of the text within that field, and save again, there seems to be an empty paragraph and break tag left over?

This is causing some annoying issues on the front end, as now I need to check for the field being empty OR the field containing these empty tags e.g. empty.

Not the end of the world by any means, but would love to know if there was a way to fix it!

 ![structured-text-error](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/1X/4a2f7e09746e626457b6519f91bfba1122fcbab0.png)

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [July 2, 2020, 3:57pm UTC](https://community.prismic.io/t/structured-text-error/1036/2 "2020-07-02T15:57:42Z")

</div>

Hey Tim,

Sorry I missed this.

Can you tell what development kit your are using and what is being returned in your api response after you delete the text?

Thanks.

---

<div class="post-metadata">

**Author:** ![tim](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tim/32/8921_2.png) [@tim](https://community.prismic.io/u/tim)\
**Post date:** [July 2, 2020, 4:22pm UTC](https://community.prismic.io/t/structured-text-error/1036/3 "2020-07-02T16:22:14Z")

</div>

Hey Phil,

Thanks for following up!

I’m using graphql, and the results are below from the Prismic GraphiQL interface.

So you can replicate, all you need to do is make a new custom type with a Rich Text Field, that supports paragraphs (and multiple paragraphs), e.g. the default type of rich text.

Then if you follow the 3 steps below, you will see how the empty paragraph tag and line break is orphaned in the field, which is still sent to the output.

Step 1) Create new document, save and publish. Do not add any data to the fields. View in GraphiQL:

```
{
  "data": {
    "article": {
      "footnote": null,
    }
  }
}

```

Step 2) Enter some content into the field, save and publish. View in GraphiQL:

```
{
  "data": {
    "article": {
      "footnote": [
        {
          "type": "paragraph",
          "text": "test",
          "spans": []
        }
      ],
    }
  }
}

```

Step 3) Deleting the content from the field (e.g. completely empty field), save and publish. View in GraphiQL:

```
{
  "data": {
    "article": {
      "footnote": [
        {
          "type": "paragraph",
          "text": "",
          "spans": []
        }
      ],
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [July 2, 2020, 4:54pm UTC](https://community.prismic.io/t/structured-text-error/1036/6 "2020-07-02T16:54:10Z")

</div>

OK, got you now.

We are aware of this. I believe this was a choice from the team, I can’t remember exactly the reasoning, so I’m going to contact them for extra information on this. Once I know more I’ll update you here.

---

<div class="post-metadata">

**Author:** ![tim](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tim/32/8921_2.png) [@tim](https://community.prismic.io/u/tim)\
**Post date:** [July 2, 2020, 5:15pm UTC](https://community.prismic.io/t/structured-text-error/1036/7 "2020-07-02T17:15:00Z")

</div>

Thanks @Phil,

I’ll be interested to hear what the team says, or has in store for this.

Might be handy for others to know as well, because I was scratching my head for a while there.  
I was obviously expecting a null response but couldn’t figure out why I was getting an empty paragraph.

So on the front end you must check for null as well as an empty paragraph string within the results array/object, if you don’t want extra spaces!

Cheers,

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [July 3, 2020, 2:26pm UTC](https://community.prismic.io/t/structured-text-error/1036/8 "2020-07-03T14:26:56Z")

</div>

So I talked with some of the team and there doesn’t appear to be structural reason why returning the data like this is necessary and the team will now begin making plans to fix this.

I don’t have an ETA of when/if they will do this, but as soon as they have more information or have anymore questions, they will get update you here.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [September 18, 2020, 1:00pm UTC](https://community.prismic.io/t/structured-text-error/1036/9 "2020-09-18T13:00:26Z")

</div>

This is being tracked as an open feature request.

If you have another use-case for this feature, you can ['Flag' this topic to reopen](https://community.prismic.io/t/re-open-a-thread/2175). Please use the ❤ button to show your support for the feature and check out our [Feature Request Guidelines](https://community.prismic.io/t/feature-requests-what-do-you-already-love-what-could-be-better/844).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 2:57pm UTC](https://community.prismic.io/t/structured-text-error/1036/10 "2021-12-09T14:57:54Z")

</div>



---

<div class="post-metadata">

**Author:** ![dan.nistor](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@dan.nistor](https://community.prismic.io/u/dan.nistor)\
**Post date:** [March 2, 2022, 1:26pm UTC](https://community.prismic.io/t/structured-text-error/1036/11 "2022-03-02T13:26:22Z")

</div>

Hi @Phil . I'm having a similar issue. While the field is empty in the Documents interface the API response contains an empty p tag.  
This is quite troublesome because we have conditional display based on the fact that the field has any data inserted or not.

Current situation:

```auto
"additional_information": [
        {
            "type": "paragraph",
            "text": "",
            "spans": []
        }
    ],

```

while I would expect

```auto
 "additional_information": [],

```

Do you have any details on how can we avoid having this kind of situation? Thanks!

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [March 3, 2022, 11:08am UTC](https://community.prismic.io/t/structured-text-error/1036/15 "2022-03-03T11:08:31Z")

</div>

Hello @dan.nistor

This is something we are aware of and still have no ETA or clear plans on modifying this. I understand that this is troublesome.

You need to apply conditional validation to the Rich Text fields so that they don't throw an error if it's empty.

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [March 3, 2022, 5:28pm UTC](https://community.prismic.io/t/structured-text-error/1036/17 "2022-03-03T17:28:38Z")

</div>

Hello @dan.nistor

I have got some information from my colleague. What version of @prismic/helpers are you using? Prismic helpers has this functionality to check if a field has a value.  
Find more detail in the@prismic/helpers [technical reference article](https://prismic.io/docs/technical-reference/prismicio-helpers#isfilled).

Let me know if you have further questions.

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![dan.nistor](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@dan.nistor](https://community.prismic.io/u/dan.nistor)\
**Post date:** [March 4, 2022, 9:26am UTC](https://community.prismic.io/t/structured-text-error/1036/18 "2022-03-04T09:26:33Z")

</div>

Hi @Priyanka, thanks for the quick response.  
Unfortunately the `@prismic/helpers` cannot be used in my case because I'm using REST API and the php sdk.

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [March 8, 2022, 1:09pm UTC](https://community.prismic.io/t/structured-text-error/1036/19 "2022-03-08T13:09:48Z")

</div>

@dan.nistor In that case you need to apply conditional validation to the Rich Text fields so that they don't throw an error if it's empty.

Feel free to reach out to us if you have any questions.

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![manuel1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/manuel1/32/5159_2.png) [@manuel1](https://community.prismic.io/u/manuel1)\
**Post date:** [July 18, 2023, 1:56pm UTC](https://community.prismic.io/t/structured-text-error/1036/21 "2023-07-18T13:56:25Z")

</div>

> [@Priyanka](#):
>
> This is something we are aware of and still have no ETA or clear plans on modifying this. I understand that this is troublesome.

It's nice to hear that the prismic team just ignore basic issues like this...

---

<div class="post-metadata">

**Author:** ![tim](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tim/32/8921_2.png) [@tim](https://community.prismic.io/u/tim)\
**Post date:** [July 18, 2023, 2:12pm UTC](https://community.prismic.io/t/structured-text-error/1036/22 "2023-07-18T14:12:29Z")

</div>

Hey @Phil,

We're approaching the 2 year anniversary of this post now and I was wondering how your talk went with the team?

They were meant to update us here but ..... crickets lol.

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [July 20, 2023, 9:53am UTC](https://community.prismic.io/t/structured-text-error/1036/24 "2023-07-20T09:53:22Z")

</div>

Hello Tim,

I apologies but there is no update.

Thanks,  
Priyanka
