iflytek/astron-agent · error · BusinessException

REPO_FILE_EMBEDDING_FAILED

REPO_FILE_EMBEDDING_FAILED

Error message

REPO_FILE_EMBEDDING_FAILED

What it means

FileInfoV2Service throws REPO_FILE_EMBEDDING_FAILED when the remote RAG embedding binding call fails: either the HTTP response's JSON code field is non-zero (bindObject.getIntValue("code") != 0) or any exception occurs during the bind/embedding request (parse errors, IO errors, timeouts), which is caught and rethrown as this BusinessException. It signals that the file could not be embedded/vectorized by the downstream RAG service.

Solutions

  1. Check the RAG embedding service health and logs for the actual upstream error code returned in the bind response body.
  2. Retry the operation once the embedding service is reachable; transient network failures are converted into this same error.
  3. Validate the file is supported for embedding (format, size) before retrying.
  4. Confirm auth headers and spaceId are correctly forwarded to the embed/bind HTTP call (OkHttpUtil.post with header).

Example fix

// before
try {
    String bindRsp = OkHttpUtil.post(bindUrl, header, params.toJSONString());
    JSONObject bindObject = JSONObject.parseObject(bindRsp);
    if (bindObject.getIntValue("code") != 0) {
        throw new BusinessException(ResponseEnum.REPO_FILE_EMBEDDING_FAILED);
    }
} catch (BusinessException be) {
    throw be;
} catch (Exception ex) {
    log.error("embedding bind failed", ex);
    throw new BusinessException(ResponseEnum.REPO_FILE_EMBEDDING_FAILED);
}
// after
String bindRsp = OkHttpUtil.post(bindUrl, header, params.toJSONString());
if (bindRsp == null || bindRsp.isEmpty()) {
    throw new BusinessException(ResponseEnum.REPO_FILE_EMBEDDING_FAILED, "empty bind response");
}
JSONObject bindObject = JSONObject.parseObject(bindRsp);
if (bindObject.getIntValue("code") != 0) {
    log.error("embed bind failed, upstream code={}, msg={}", bindObject.getIntValue("code"), bindObject.getString("message"));
    throw new BusinessException(ResponseEnum.REPO_FILE_EMBEDDING_FAILED);
}
Defensive patterns

Strategy: retry

Validate before calling

// preflight: embedding service reachable and file embeddable
if (!ragHealthCheck()) throw new IllegalStateException("embedding service unavailable");
if (file.getSize() > MAX_EMBED_SIZE) throw new IllegalStateException("file too large to embed");

Type guard

boolean isSuccessfulBindResponse(String body) {
    if (body == null || body.isEmpty()) return false;
    try { return JSONObject.parseObject(body).getIntValue("code") == 0; }
    catch (Exception e) { return false; }
}

Try / catch

try {
    fileInfoV2Service.retryEmbedding(vo, request);
} catch (BusinessException e) {
    log.error("embedding failed for files {}", vo.getFileIds(), e);
    // mark files as EMBED_FAILED and surface upstream message to user; retry with backoff
}

Prevention

When it happens

Trigger: Calling the retry/embedding path in FileInfoV2Service where the bind endpoint (OkHttp call) returns a JSON body with code != 0, or the request itself throws (connection refused, timeout, malformed JSON) inside the try block around the bindRsp handling.

Common situations: RAG/embedding service is down or unreachable in the environment; the embedding service rejects the file (unsupported type, size limit); auth token/space header missing so the upstream returns an error code; response format changed upstream so parseObject throws.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/8753ac398ef00629. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java:1223

                    throw new BusinessException(ResponseEnum.REPO_FILE_EMBEDDING_FAILED);
                } else {
                    // Call document binding
                    JSONObject bindParams = new JSONObject();
                    bindParams.put("datasetId", sliceFileVO.getRepoId());
                    bindParams.put("files", sliceFileVO.getSparkFiles());
                    HashMap<String, String> bindHeader = new HashMap<>();
                    String authorization = request.getHeader("Authorization");
                    if (StringUtils.isNotBlank(authorization)) {
                        bindHeader.put("Authorization", authorization);
                    }
                    String bindRsp = OkHttpUtil.post(apiUrl.getXinghuoDatasetFileUrl(), bindHeader, bindParams.toJSONString());
                    JSONObject bindObject = JSONObject.parseObject(bindRsp);
                    if (bindObject.getIntValue("code") != 0) {
                        throw new BusinessException(ResponseEnum.REPO_FILE_EMBEDDING_FAILED);
                    }
                }
            } catch (Exception ex) {
                throw new BusinessException(ResponseEnum.REPO_FILE_EMBEDDING_FAILED);
            }
        } else {
            List<Long> fileIds = sliceFileVO.getFileIds()
                    .stream()
                    .map(Long::valueOf) // Convert String to Long
                    .collect(Collectors.toList());
            if (!CollectionUtils.isEmpty(fileIds)) {
                ExecutorService executorService = Executors.newFixedThreadPool(fileIds.size());
                for (Long fileId : fileIds) {
                    FileInfoV2 fileInfo = this.getById(fileId);
                    if (fileInfo == null) {
                        log.warn("embeddingBack skip: file not found, id={}", fileId);
                        continue;
                    }
                    if (sliceFileVO.getIsBackTask() == null) {
                        dataPermissionCheckTool.checkFileBelong(fileInfo);
                    }

View on GitHub (pinned to 5e758547a8)