OtterMind/Chat2DB · error · BusinessException

largeCellValue.downloadFailed

largeCellValue.downloadFailed

Error message

largeCellValue.downloadFailed

What it means

Wraps SQLException or IOException raised while building the download payload in prepareDownload() (type detection, binary-content sniffing, byte conversion). The original message is the first format arg and the cause 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:106

            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()
                    ? detectBinaryContentType(valueType, openBinaryStream(resultSet, value))
                    : BinaryContentTypeEnum.UNKNOWN;
            LargeValueTypeEnum displayMode = valueType.withDetectedBinaryContent(binaryContentType);
            String fileName = fileName(reference, outputFormat, displayMode, binaryContentType);
            byte[] payload = toDownloadBytes(resultSet, value, outputFormat, displayMode);
            return CellValueDownload.builder()
                    .inputStream(new ByteArrayInputStream(payload))
                    .fileName(fileName)
                    .contentType(downloadContentType(outputFormat, displayMode, binaryContentType))
                    .build();
        } catch (SQLException | IOException e) {
            throw new BusinessException("largeCellValue.downloadFailed", new Object[]{e.getMessage()}, e);
        }
    }

    private int normalizeLimit(Integer limit, CellValueFormatEnum format) {
        int resolved = limit == null || limit <= 0 ? DEFAULT_CHUNK_SIZE : limit;
        resolved = Math.min(resolved, MAX_CHUNK_SIZE);
        if (format.isBase64() && resolved < BASE64_BYTE_GROUP) {
            return BASE64_BYTE_GROUP;
        }
        if (format.isBase64() && resolved > BASE64_BYTE_GROUP) {
            return resolved - (resolved % BASE64_BYTE_GROUP);
        }
        return resolved;
    }

    private PreparedStatement prepareStatement(LargeValueReference reference) throws SQLException {
        if (reference.getPrimaryKey() == null || reference.getPrimaryKey().isEmpty()) {
            throw new BusinessException("largeCellValue.rowLocatorRequired");

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Read the chained cause to identify the SQLException/IOException root.
  2. For streaming/size failures, download a smaller chunk or increase driver LOB limits.
  3. Retry after reconnecting if the cause is a dropped connection.
  4. Regenerate the reference from a fresh result set.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    CellValueDownload dl = cellValueService.prepareDownload(reference, format);
    // stream dl.getInputStream()
} catch (BusinessException e) {
    if ("largeCellValue.downloadFailed".equals(e.getCode())) {
        // log e.getCause(); offer chunked download or reconnect+retry
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: During download assembly: openBinaryStream or detectBinaryContentType fails, toDownloadBytes throws on a conversion/streaming error, or the JDBC connection drops while materializing the bytes.

Common situations: Large LOB exceeds driver/stream limits, binary content-type sniffing reads a closed stream, connection reset while streaming a big payload, or an unsupported format conversion.

Related errors


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