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.

Solutions

  1. Inspect the chained cause (e.getMessage() in the args and the throwable) to find the real JDBC/IO error.
  2. For transient SQLExceptions (connection reset, timeout), retry after re-establishing the connection context.
  3. For type-conversion errors, confirm the LargeValueReference.sqlType/columnType matches the actual column.
  4. 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

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


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/73f7d0a1f4d701e4. Report an issue: GitHub.

Appendix: 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)