conductor-oss/conductor · error · NonTransientException

Error serializing to json

Error message

Error serializing to json

What it means

Thrown by CassandraBaseDAO.toJson when ObjectMapper.writeValueAsString fails. It wraps JsonProcessingException in a NonTransientException because a serialization failure is a permanent data-shape problem, not a transient DB issue. Used by all Cassandra DAOs to serialize workflow/task/event payloads before storing them as text.

Source

Thrown at cassandra-persistence/src/main/java/com/netflix/conductor/cassandra/dao/CassandraBaseDAO.java:308

                .addColumn(EVENT_HANDLER_KEY, DataType.text())
                .getQueryString();
    }

    private String getCreateEventExecutionsTableStatement() {
        return SchemaBuilder.createTable(properties.getKeyspace(), TABLE_EVENT_EXECUTIONS)
                .ifNotExists()
                .addPartitionKey(MESSAGE_ID_KEY, DataType.text())
                .addPartitionKey(EVENT_HANDLER_NAME_KEY, DataType.text())
                .addClusteringColumn(EVENT_EXECUTION_ID_KEY, DataType.text())
                .addColumn(PAYLOAD_KEY, DataType.text())
                .getQueryString();
    }

    String toJson(Object value) {
        try {
            return objectMapper.writeValueAsString(value);
        } catch (JsonProcessingException e) {
            throw new NonTransientException("Error serializing to json", e);
        }
    }

    <T> T readValue(String json, Class<T> clazz) {
        try {
            return objectMapper.readValue(json, clazz);
        } catch (IOException e) {
            throw new NonTransientException("Error de-serializing json", e);
        }
    }

    void recordCassandraDaoRequests(String action) {
        recordCassandraDaoRequests(action, "n/a", "n/a");
    }

    void recordCassandraDaoRequests(String action, String taskType, String workflowType) {
        Monitors.recordDaoRequests(DAO_NAME, action, taskType, workflowType);
    }

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Read the wrapped JsonProcessingException to find the offending property.
  2. Register required Jackson modules on the shared ObjectMapper (GuavaModule, Jdk8Module, JavaTimeModule) and ensure Conductor's ObjectMapperProvider is used.
  3. Add @JsonIgnore to non-serializable/transient fields or fix the model to be POJO-compliant.
  4. Add a unit test that round-trips the affected domain object through the same ObjectMapper.

Example fix

// before
throw new NonTransientException("Error serializing to json", e);

// after (include the failing object type for faster diagnosis)
throw new NonTransientException(
    "Error serializing to json: " + value.getClass().getName(), e);
Defensive patterns

Strategy: validation

Validate before calling

// Smoke-test the configured ObjectMapper can serialize your domain model at startup
objectMapper.writeValueAsString(new WorkflowModel()); // throws early if misconfigured

Try / catch

try {
    return toJson(value);
} catch (NonTransientException e) {
    log.error("Cannot serialize {}: {}", value.getClass(), e.getCause().getMessage());
    throw e;
}

Prevention

When it happens

Trigger: Calling toJson(Object) on a domain object (WorkflowModel, TaskModel, EventHandler) that Jackson cannot serialize — e.g. contains a non-serializable field, a circular reference, or lacks the necessary accessors/mixins.

Common situations: A model change that added a field Jackson cannot handle. A custom ObjectMapper configuration missing required modules (e.g. Guava, Jdk8, JavaTime). Serializing an object whose lazy/init fields throw on access.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/5c8cd8051254b92b. Report an issue: GitHub.