flowable/flowable-engine · error · FlowableException
Error writing form model response
Error message
Error writing form model response
What it means
RestResponseFactory.getFormModelString serializes a FormModelResponse to JSON with the configured ObjectMapper. Any exception during serialization (unwritable property, failing custom serializer, invalid underlying object graph) is wrapped and rethrown as a generic FlowableException with this message.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/RestResponseFactory.java:289
response.setStartFormDefined(processDefinition.hasStartFormKey());
response.setGraphicalNotationDefined(processDefinition.hasGraphicalNotation());
response.setTenantId(processDefinition.getTenantId());
// Links to other resources
response.setDeploymentId(processDefinition.getDeploymentId());
response.setDeploymentUrl(urlBuilder.buildUrl(RestUrls.URL_DEPLOYMENT, processDefinition.getDeploymentId()));
response.setResource(urlBuilder.buildUrl(RestUrls.URL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getResourceName()));
if (processDefinition.getDiagramResourceName() != null) {
response.setDiagramResource(urlBuilder.buildUrl(RestUrls.URL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getDiagramResourceName()));
}
return response;
}
public String getFormModelString(FormModelResponse formModelResponse) {
try {
return objectMapper.writeValueAsString(formModelResponse);
} catch (Exception e) {
throw new FlowableException("Error writing form model response", e);
}
}
public List<RestVariable> createRestVariables(Map<String, Object> variables, String id, int variableType, RestVariableScope scope) {
RestUrlBuilder urlBuilder = createUrlBuilder();
List<RestVariable> result = new ArrayList<>(variables.size());
for (Entry<String, Object> pair : variables.entrySet()) {
result.add(createRestVariable(pair.getKey(), pair.getValue(), scope, id, variableType, false, urlBuilder));
}
return result;
}
public RestVariable createRestVariable(String name, Object value, RestVariableScope scope, String id, int variableType, boolean includeBinaryValue) {
return createRestVariable(name, value, scope, id, variableType, includeBinaryValue, createUrlBuilder());
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Inspect the wrapped cause exception (e.getCause()) — it names the exact serialization failure (property/class).
- Fix the offending field on the FormModelResponse: mark it @JsonIgnore/transient or remove the cyclic reference.
- Ensure the ObjectMapper used by RestResponseFactory is configured (e.g. FAIL_ON_EMPTY_BEANS disabled) for your custom types.
- If a Flowable/Jackson upgrade introduced it, align Jackson versions between flowable-rest and your application.
Example fix
// before
class MyFormModel extends FormModelResponse { private ProcessDefinition pd; /* cyclic */ }
// after
class MyFormModel extends FormModelResponse {
@JsonIgnore
private ProcessDefinition pd; // or store pd.getId() instead
} Defensive patterns
Strategy: try-catch
Try / catch
try { json = factory.getFormModelString(response); } catch (FlowableException e) { logger.error("Form model serialization failed", e.getCause()); } Prevention
- Keep FormModelResponse payloads free of cyclic references
- Annotate non-serializable fields with @JsonIgnore
- Align Jackson versions across flowable-rest and your app
When it happens
Trigger: Calling getFormModelString(formModelResponse) when objectMapper.writeValueAsString throws — e.g. a self-referencing form field model, a getter that throws, or a form data type the registered serializers cannot handle.
Common situations: Custom FormModelResponse subclasses with non-serializable fields, Jackson version mismatches after upgrading Flowable/Spring Boot, or form info containing cyclic references from custom form implementations.
Understand the failure class
Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.
Related errors
- Error writing app model to json
- Error writing form model response
- Failed to parse jase
- Could not read json event payload
- Cannot convert event payload ${jsonValue} to type 'json'
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/a559918143fbb1bf.
Report an issue: GitHub.