Single character causing Panel error: "Please fix all form errors" & "The JSON response of the API could not be parsed"

Hello!

I have recently uploaded a site to a shared hosting environment and am receiving an error when clicking the “OK”/save after submitting text content in a custom block structure field.

The strange thing is, is that it is dependent on the content that is input. There are currently 17189 text characters input in the field. I found that it is a single bracket ( that is causing the error. There are other brackets in the text, however if this particular one is added, the error is thrown.

Please fix all form errors
The JSON response of the API could not be parsed

In dev tools it seems like there is both:
Validate Error
app.js Error

  1. Request URL:
    https://roomsheet.ima.org.au/api/pages/example-exhibition/fields/details/fieldsets/artworks/fields/artworkstructure/validate

  2. Request Method:
    POST

  3. Status Code:
    418

Response Headers

  1. content-length:
    543

  2. content-type:
    text/html; charset=iso-8859-1

  3. date:
    Thu, 28 Jan 2021 00:05:51 GMT

  4. server:
    Apache

Panel was installed locally.
I have used this hosting provider before, however not with Kirby 3.5.1.

Any ideas would be super helpful.

The field causing the error is a custom block:

          artworks:
            name: Artwork list
            fields:
              artworkStructure:
                label: Artwork List
                type: structure
                columns:
                  contentType:
                    width: 1/3
                  galleryTitle:
                    width: 1/3
                  artworkNumber:
                    width: 1/3
                fields:
                  contentType:
                    label: Artwork or gallery title?
                    help: If you need to add a gallery title eg. Gallery 1 choose gallery title.
                    default: artwork
                    type: radio
                    options:
                      artwork: Artwork
                      gallery: Gallery title
                  galleryTitle:
                    type: text
                    label: Gallery Name/Number
                    when:
                      contentType: gallery
                    placeholder: eg. Gallery 1
                    width: 2/3
                  galleryExplainer:
                    type: writer
                    when:
                      contentType: gallery
                    label: Gallery intro text
                    help: Use this field if you need to add a text under the gallery title. Otherwise, leave blank.
                  artworkNumber:
                    type: text
                    width: 1/4
                    label: Artwork Number
                    when:
                      contentType: artwork
                  artworkTitle: -------------------THIS HERE
                    type: writer
                    width: 3/4
                    label: Artwork details
                    when:
                      contentType: artwork

So you don’t get this error in your local environment? Just guessing maybe an issue with the charset?

Correct, I don’t get it in my local environment. Only on server.

I have below set in snippet:
<meta charset="utf-8">

What I stumbled over was this in the Response header…

Hi @texnixe, it’s my understanding that that charset=iso-8859-1 would be set by kirby because the error is happening in the panel. Would that be right?

I am going to do a fresh starterkit install on this server to see if the problem persists.

Looks like I was able to solve it by deactivating the modsec rule. I will keep an eye on it and mark this solved if the error doesn’t resurface.

No, Kirby’s default charset is utf-8, unless maybe detected otherwise.