jeecgboot/JeecgBoot · warning · JeecgBootBizTipException

请先添加变量或者记忆后再次重试!

Error message

请先添加变量或者记忆后再次重试!

What it means

This error is thrown by AiragAppServiceImpl.generateMemoryByAppId() when both the variables parameter and the memoryId parameter are empty. The method generates AI memory content by combining variable definitions and memory context; if neither is provided, there is nothing to generate from, so it rejects the request immediately.

Source

Thrown at jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/app/service/impl/AiragAppServiceImpl.java:97

        params.setFrequencyPenalty(0.1);
        if(blocking){
            String promptValue = aiChatHandler.completionsByDefaultModel(messages, params);
            if (promptValue == null || promptValue.isEmpty()) {
                return Result.error("生成失败");
            }
            return Result.OK("success", promptValue);
        }else{
            //update-begin---author:wangshuai---date:2026-01-08---for: 将流式输出单独抽出去,变量和记忆也需要---
            return startSseChat(messages, params);
            //update-end---author:wangshuai---date:2026-01-08---for: 将流式输出单独抽出去,变量和记忆也需要---
        }
    }

    //update-begin---author:wangshuai---date:2026-01-05---for:【QQYUN-14479】增加一个开启记忆的按钮。下面为提示词和记忆,将记忆提示词单独拆分---
    @Override
    public Object generateMemoryByAppId(String variables, String memoryId, boolean blocking) {
        if(oConvertUtils.isEmpty(variables) && oConvertUtils.isEmpty(memoryId)){
            throw new JeecgBootBizTipException("请先添加变量或者记忆后再次重试!");
        }
        // 构建变量描述
        StringBuilder variablesDesc = new StringBuilder();
        if (oConvertUtils.isNotEmpty(variables)) {
            List<AppVariableVo> variableList = JSONArray.parseArray(variables, AppVariableVo.class);
            if (variableList != null && !variableList.isEmpty()) {
                for (AppVariableVo var : variableList) {
                    if (var.getEnable() != null && !var.getEnable()) {
                        continue;
                    }
                    String name = var.getName();
                    if (oConvertUtils.isNotEmpty(var.getAction())) {
                        String action = var.getAction();
                        if (oConvertUtils.isNotEmpty(name)) {
                            try {
                                // 使用正则替换未被{{}}包裹的变量名
                                String regex = "(?<!\\{\\{)\\b" + Pattern.quote(name) + "\\b(?!\\}\\})";
                                action = action.replaceAll(regex, "{{" + name + "}}");

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Ensure at least one of variables or memoryId is provided when calling generateMemoryByAppId.
  2. If using the AI app UI, verify that the app has at least one variable defined or a memory configured before triggering memory generation.
  3. If calling programmatically, pass the app's variable JSON array or a valid memoryId from the conversation context.
  4. Check the calling code to ensure it passes the correct values from the request or session.

Example fix

// before — calling without required inputs
airagAppService.generateMemoryByAppId(null, null, true);

// after — provide at least one input
airagAppService.generateMemoryByAppId(appVariablesJson, memoryId, true);
Defensive patterns

Strategy: validation

Validate before calling

// Validate inputs before calling generateMemoryByAppId
if ((variables == null || variables.trim().isEmpty())
    && (memoryId == null || memoryId.trim().isEmpty())) {
    // Provide user-facing guidance instead of hitting the exception
    return Result.error("请先配置变量或选择记忆后再试");
}
airagAppService.generateMemoryByAppId(variables, memoryId, blocking);

Type guard

public static boolean hasMemoryInputs(String variables, String memoryId) {
    boolean hasVars = variables != null && !variables.trim().isEmpty();
    boolean hasMem = memoryId != null && !memoryId.trim().isEmpty();
    return hasVars || hasMem;
}

Try / catch

try {
    Object result = airagAppService.generateMemoryByAppId(variables, memoryId, blocking);
    return result;
} catch (JeecgBootBizTipException e) {
    if (e.getMessage().contains("请先添加变量或者记忆")) {
        // Return user-friendly guidance instead of propagating the exception
        return Result.error("请先为应用配置变量或记忆");
    }
    throw e;
}

Prevention

When it happens

Trigger: A call to generateMemoryByAppId(variables, memoryId, blocking) where variables is empty/null AND memoryId is empty/null. The method uses oConvertUtils.isEmpty() which treats null, empty string, and whitespace-only strings as empty. This is a pre-condition validation check before attempting any LLM call.

Common situations: The AI application's memory generation is triggered from a UI where the user hasn't configured any variables or selected a memory. A programmatic caller omits both parameters. The app configuration was reset or migrated and lost its variable/memory definitions.

Related errors


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