<-- Back

Can not write a field name, expecting a value error

Issue

The error "Can not write a field name, expecting a value" indicates that the JSON that was received was malformed. This causes errors in (or after) microflows and popups of "An unexpected error occurred". When you look into the logs, you find a stacktrace that starts with: 

2022-12-21T18:58:09.305970 [APP/PROC/WEB/0] ERROR - Connector: com.mendix.systemwideinterfaces.MendixRuntimeException: com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a value
2022-12-21T18:58:09.306014 [APP/PROC/WEB/0] at com.mendix.util.classloading.Runner$.withContextClassLoader(Runner.scala:23)
2022-12-21T18:58:09.306132 [APP/PROC/WEB/0] Caused by: com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a value

Environment

Studio Pro (all versions)

Cause

When the error is encountered, it is generally because the connection was closed before the JSON was fully sent. Therefore, a malformed JSON was received, and then applying (part of) the incorrect JSON to a field (for example, an attribute or an error message) causes this error. 

This means that the cause of this error is usually logged (just) before the stacktrace. For example, you may see an EofException type of error:

2022-12-21T18:58:09.292874 [APP/PROC/WEB/0] ERROR - Connector: An error has occurred while handling the request. 
2022-12-21T18:58:09.292892 [APP/PROC/WEB/0] ERROR - Connector: org.eclipse.jetty.io.EofException: null

In such a case, the connection is closed before the JSON is sent fully (most likely from the client side, or some component between the client and server). 

Solution/Workaround

Investigate the surrounding logs of this error and look for an error that caused the connection to be closed before the full JSON was sent. Once it is fixed, the error message should disappear.

Internal information related

  • 209488, 174196 
  • CJZ85RLTA/p1672130227653359 

Additional information

Not applicable

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.