OtterMind/Chat2DB · error · BusinessException
data.export.json.error
data.export.json.error
Error message
data.export.json.error
What it means
BusinessException 'data.export.json.error' from JsonDataExporter.writeBatch when ObjectMapper.writeValueAsString throws JsonProcessingException serializing a data batch to JSON during streaming export.
Source
Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/task/export/json/JsonDataExporter.java:88
writer.println(",");
}
asyncContext.info(DateUtil.formatTime(new Date()) + ":" + String.format("Exported %d rows", n));
writeBatch(writer, objectMapper, dataBatch);
firstBatch = false;
}
}
writer.println("]");
}, asyncContext, asyncContext::checkCancelled);
}
private void writeBatch(PrintWriter writer, ObjectMapper objectMapper, List<Map<String, Object>> dataBatch) {
try {
String jsonBatch = objectMapper.writeValueAsString(dataBatch);
writer.println(jsonBatch.substring(1, jsonBatch.length() - 1));
writer.flush();
dataBatch.clear();
} catch (JsonProcessingException e) {
throw new BusinessException("data.export.json.error", null, e);
}
}
}
View on GitHub (pinned to 5ee1e990e7)
Solutions
- Inspect the wrapped JsonProcessingException for the offending type and convert that column to a String/plain value before batching.
- Configure the ObjectMapper used by the exporter (register JavaTimeModule / SqlModule) to handle the JDBC types present.
- Skip or stringify problematic columns in the export query/projection.
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-configure the exporter ObjectMapper with JDBC/time modules ObjectMapper om = new ObjectMapper(); om.registerModule(new com.fasterxml.jackson.datatype.jsr310.JavaTimeModule()); om.disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Try / catch
try { String batch = objectMapper.writeValueAsString(dataBatch); }
catch (JsonProcessingException e) {
throw new BusinessException("data.export.json.error", null, e);
} Prevention
- Register JavaTime/Sql modules on the export ObjectMapper.
- Convert exotic JDBC types (BLOB/array) to String before batching.
- Test export with the actual column types of high-variance tables.
When it happens
Trigger: A row map contains a value ObjectMapper cannot serialize (e.g. a non-JSON-serializable type, a self-referencing object, or a JDBC type without a serializer), or serialization hits a JDK type restriction.
Common situations: ResultSet column mapped to an exotic SQL/JDBC type (BLOB, array, custom); null-handling producing an unsupported Java type; mapper misconfiguration after an upgrade.
Related errors
- ai.chat.history.loadSessionsFailed
- ai.chat.history.loadMessagesFailed
- Failed to load ai config from
- Failed to persist ai config to
- exportType
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/b705a3172711f9c4.
Report an issue: GitHub.