OtterMind/Chat2DB · error · BusinessException
largeCellValue.readFailed
largeCellValue.readFailed
Error message
largeCellValue.readFailed
What it means
Wraps any SQLException or IOException raised while reading a chunked large cell value (executing the prepared statement, getObject, streaming binary/text). The original exception's message is passed as the first format arg and the throwable is chained.
Source
Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbCellValueServiceImpl.java:76
readCellValueChunkRequest == null ? null : readCellValueChunkRequest.getFormat());
long offset = Math.max(0L, offsetParam == null ? 0L : offsetParam);
int limit = normalizeLimit(limitParam, format);
try (PreparedStatement statement = prepareStatement(reference);
ResultSet resultSet = statement.executeQuery()) {
if (!resultSet.next()) {
throw new BusinessException("largeCellValue.rowNotFound");
}
Object value = resultSet.getObject(1);
int sqlType = reference.getSqlType() == null ? resultSet.getMetaData().getColumnType(1) : reference.getSqlType();
String columnType = StringUtils.defaultIfBlank(reference.getColumnType(),
resultSet.getMetaData().getColumnTypeName(1));
LargeValueTypeEnum valueType = LargeValueTypeEnum.resolveForRead(value, columnType, sqlType,
reference.getValueType());
return valueType.isBinaryLike()
? readBinaryChunk(resultSet, value, offset, limit, format, reference, valueType)
: readTextChunk(resultSet, value, offset, limit, format, reference, valueType);
} catch (SQLException | IOException e) {
throw new BusinessException("largeCellValue.readFailed", new Object[]{e.getMessage()}, e);
}
}
@Override
public CellValueDownload prepareDownload(LargeValueReference reference, String format) {
try (PreparedStatement statement = prepareStatement(reference);
ResultSet resultSet = statement.executeQuery()) {
if (!resultSet.next()) {
throw new BusinessException("largeCellValue.rowNotFound");
}
Object value = resultSet.getObject(1);
int sqlType = reference.getSqlType() == null ? resultSet.getMetaData().getColumnType(1) : reference.getSqlType();
String columnType = StringUtils.defaultIfBlank(reference.getColumnType(),
resultSet.getMetaData().getColumnTypeName(1));
LargeValueTypeEnum valueType = LargeValueTypeEnum.resolveForRead(value, columnType, sqlType,
reference.getValueType());
CellValueFormatEnum outputFormat = CellValueFormatEnum.fromRequest(format).forDownload();
BinaryContentTypeEnum binaryContentType = valueType.isBinaryLike()View on GitHub (pinned to 5ee1e990e7)
Solutions
- Inspect the chained cause (e.getMessage() in the args and the throwable) to find the real JDBC/IO error.
- For transient SQLExceptions (connection reset, timeout), retry after re-establishing the connection context.
- For type-conversion errors, confirm the LargeValueReference.sqlType/columnType matches the actual column.
- Reopen the cell from a refreshed result set to regenerate the reference.
Defensive patterns
Strategy: try-catch
Try / catch
try {
cellValueService.readChunk(request);
} catch (BusinessException e) {
if ("largeCellValue.readFailed".equals(e.getCode()) && e.getCause() != null) {
// inspect e.getCause() (SQLException/IOException) for the real reason
// retry once if it is a transient connection error
} else {
throw e;
}
} Prevention
- Log the chained cause, not just the wrapped message, for diagnosis.
- Reconnect before retrying readChunk when the cause is a connection drop.
- Confirm reference.sqlType/columnType match the column to avoid conversion errors.
When it happens
Trigger: readChunk() executes the SELECT and the read path throws SQLException (connection dropped, data type conversion error, permission revoked) or IOException (stream read failure during readBinaryChunk/readTextChunk).
Common situations: Connection reset mid-stream on a LOB/CLOB, dialect returning an object the reader cannot coerce, blob stream closed prematurely by the driver, or transient network blips to the DB.
Related errors
- largeCellValue.downloadFailed
- largeCellValue.rowNotFound
- largeCellValue.rowLocatorRequired
- Failed to update local file
- ai.attachment.localParseFailed
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/73f7d0a1f4d701e4.
Report an issue: GitHub.