jeecgboot/JeecgBoot · error · JeecgBootException

向量存储失败:

Error message

向量存储失败:

What it means

Thrown by EmbeddingHandler during vector storage when the document content contains HTML tables. The code splits the document preserving HTML table blocks, generates embeddings via embeddingModel.embedAll(segments), and stores them via embeddingStore.addAll(). Any exception in this pipeline is caught and re-thrown as JeecgBootException with the original message appended.

Source

Thrown at jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/llm/handler/EmbeddingHandler.java:245

                // ignore:token获取不到默认为admin
                username = "admin";
            }
        }
        if (oConvertUtils.isNotEmpty(username)) {
            metadata.put(EMBED_STORE_METADATA_USER_NAME, username);
        }
        //update-end---author:wangshuai---date:2025-12-26---for:【QQYUN-14265】【AI】支持记忆---
        Document from = Document.from(content, metadata);
        //update-begin---author:wangshuai ---date:2026-04-20  for:【issues/9551】HTML表格分段时被截断,保留完整表格块-----------
        boolean hasHtmlTable = content != null && PATTERN_HTML_TABLE.matcher(content).find();
        if (hasHtmlTable) {
            try {
                List<TextSegment> segments = splitDocumentPreservingHtmlTables(from, splitter);
                List<Embedding> embeddings = embeddingModel.embedAll(segments).content();
                embeddingStore.addAll(embeddings, segments);
            } catch (Exception e) {
                log.error("向量存储失败,请检查向量模型配置是否正确", e);
                throw new JeecgBootException("向量存储失败:" + e.getMessage());
            }
        } else {
            //update-begin---author:jeecg---date:2026-02-26---for:[#9374]【AI知识库】千帆向量报错,添加异常处理防止空指针
            try {
                ingestor.ingest(from);
            } catch (Exception e) {
                log.error("向量存储失败,请检查向量模型配置是否正确", e);
                throw new JeecgBootException("向量存储失败:" + e.getMessage());
            }
            //update-end---author:jeecg---date:2026-02-26---for:[#9374]【AI知识库】千帆向量报错,添加异常处理防止空指针
        }
        //update-end---author:wangshuai ---date:2026-04-20  for:【issues/9551】HTML表格分段时被截断,保留完整表格块-----------

        return metadata.toMap();
    }

    /**
     * 创建分段器

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Check the vector model configuration (API key, endpoint, model name) in the AI knowledge-base settings.
  2. Verify the vector database is running and the collection/table schema matches the embedding dimension of the configured model.
  3. Check application logs for the original exception (logged at ERROR level with '向量存储失败,请检查向量模型配置是否正确') to identify whether the failure is in embedding generation or vector storage.
  4. If the table is very large, consider reducing chunk size in the splitting strategy.
Defensive patterns

Strategy: try-catch

Validate before calling

// Before embedding, verify model config
if (embeddingModel == null) {
    throw new JeecgBootException("向量模型未配置");
}
if (embeddingStore == null) {
    throw new JeecgBootException("向量存储未配置");
}

Try / catch

try {
    // embedding logic for HTML table content
} catch (JeecgBootException e) {
    if (e.getMessage().startsWith("向量存储失败")) {
        log.error("Vector storage failed, check model config: {}", e.getMessage());
        // notify user to check vector model configuration
    }
    throw e;
}

Prevention

When it happens

Trigger: A knowledge-base document whose parsed content matches PATTERN_HTML_TABLE triggers the special table-preserving split path. The failure occurs in embedAll() (embedding model API error, timeout, rate limit) or addAll() (vector store connectivity issue, dimension mismatch, authentication failure).

Common situations: Embedding model API key is invalid or expired; vector database (pgvector/Milvus) is unreachable or the embedding dimensions do not match the vector store schema; rate limiting from the embedding provider; the embedding model returns an error for very large table segments.

Related errors


AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14). Data as JSON: /api/errors/a29693adf7327397. Report an issue: GitHub.