iflytek/astron-agent · error · BusinessException

MODEL_NOT_EXIST

MODEL_NOT_EXIST

Error message

BusinessException(ResponseEnum.MODEL_NOT_EXIST)

What it means

In selfModelConfig, after confirming the model is custom, the service queries the model table by id. If no row matches, it throws BusinessException(MODEL_NOT_EXIST): the requested model id does not exist in the database.

Solutions

  1. Confirm the model id exists: SELECT * FROM model WHERE id = ?
  2. Refresh the model list in the UI to clear stale ids
  3. Check you are pointing at the intended database/environment
  4. Handle the error client-side by reloading models when MODEL_NOT_EXIST is returned

Example fix

// before
llmService.selfModelConfig(1234L, 0); // stale id
// after
Model current = modelList.stream().filter(m -> m.getId().equals(1234L)).findFirst()
    .orElseThrow(() -> new IllegalStateException("model 1234 no longer exists, refresh list"));
llmService.selfModelConfig(current.getId(), 0);
Defensive patterns

Strategy: validation

Validate before calling

// verify the model id exists and belongs to the current user before calling
Model m = modelMapper.selectById(id);
if (m == null) throw new IllegalStateException("model " + id + " does not exist");

Try / catch

try {
    llmService.selfModelConfig(id, 0);
} catch (BusinessException e) {
    // MODEL_NOT_EXIST: refresh model list in UI and ask user to re-select
}

Prevention

When it happens

Trigger: Calling selfModelConfig with a model id that is absent from the model table — deleted model, id from another environment/tenant, or a stale id cached in the frontend.

Common situations: Model deleted by another user while the page was open; frontend using a hardcoded or stale id; querying across environments (dev id used in prod); id passed as wrong type causing a mismatch.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/LLMService.java:550

                array.add(new JSONObject()
                        .fluentPut("domain", domain)
                        .fluentPut("channel", serviceId)
                        .fluentPut("patchId", patchId));
            }
        });

        return array;
    }

    public Object selfModelConfig(Long id, Integer llmSource) {
        if (llmSource != 0) {
            throw new BusinessException(ResponseEnum.NOT_CUSTOM_MODEL);
        }
        String uid = UserInfoManagerHandler.getUserId();

        Model one = modelMapper.selectOne(new LambdaQueryWrapper<Model>().eq(Model::getId, id));
        if (one == null) {
            throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);
        }
        if (!Objects.equals(uid, one.getUid())) {
            throw new BusinessException(ResponseEnum.EXCEED_AUTHORITY);
        }
        List<Config> configs = JSON.parseArray(one.getConfig(), Config.class);
        if (CollUtil.isNotEmpty(configs)) {
            for (Config config : configs) {
                Float precision = config.getPrecision();
                if (precision != null) {
                    // If precision is an integer greater than 1, convert to decimal form, e.g., 1 to 0.1, 2 to 0.01,
                    // etc.
                    int intPrec = Math.round(precision);
                    if (precision >= 1 && Math.abs(precision - intPrec) < 1e-6) {
                        float newPrec = 1f / (float) Math.pow(10, intPrec);
                        config.setPrecision(newPrec);
                    }
                }
            }

View on GitHub (pinned to 5e758547a8)