OtterMind/Chat2DB · error · BusinessException

ai.attachment.inputStreamRequired

ai.attachment.inputStreamRequired

Error message

ai.attachment.inputStreamRequired

What it means

Error "ai.attachment.inputStreamRequired" thrown in OtterMind/Chat2DB.

Source

Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/ai/AiAttachmentServiceImpl.java:56

    private static final int MAX_CONTENT_LENGTH = 12000;
    private static final int MAX_CONTEXT_LENGTH = 24000;
    private static final int MAX_SHEET_ROWS = 100;
    private static final int MAX_SHEET_COLUMNS = 20;
    private static final Set<String> DOCUMENT_EXTENSIONS = Set.of("pdf", "doc", "docx", "md", "txt", "json");
    private static final Set<String> TABULAR_EXTENSIONS = Set.of("csv", "xls", "xlsx");
    private static final Set<String> SUPPORTED_EXTENSIONS;

    static {
        Set<String> supportedExtensions = new LinkedHashSet<>();
        supportedExtensions.addAll(DOCUMENT_EXTENSIONS);
        supportedExtensions.addAll(TABULAR_EXTENSIONS);
        SUPPORTED_EXTENSIONS = supportedExtensions;
    }

    public ChatAttachment parse(AiAttachmentParseRequest param) {
        if (param == null || param.getInputStream() == null) {
            throw new BusinessException("ai.attachment.inputStreamRequired");
        }
        String fileName = StringUtils.defaultIfBlank(param.getFileName(), "attachment");
        try (InputStream inputStream = param.getInputStream()) {
            return parse(fileName, inputStream);
        } catch (IOException e) {
            throw new BusinessException("ai.attachment.parseFailed", new Object[]{fileName, e.getMessage()}, e);
        }
    }

    public ChatAttachment parse(AiLocalAttachmentParseRequest param) {
        if (param == null || StringUtils.isBlank(param.getFilePath())) {
            throw new BusinessException("ai.attachment.filePathRequired");
        }
        File file = new File(param.getFilePath().trim());
        if (!file.exists() || !file.isFile()) {
            throw new BusinessException("ai.attachment.fileNotFound");
        }
        String fileName = StringUtils.defaultIfBlank(param.getFileName(), file.getName());

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Provide the attachment as an input stream (multipart upload) instead of only a path.
  2. Ensure the request actually carries the file content.

When it happens

Trigger: AiAttachmentServiceImpl was asked to process an attachment but no input stream was supplied.

Common situations: See trigger scenarios.


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