iflytek/astron-agent · error · BusinessException

BOT_NOT_EXIST

BOT_NOT_EXIST

Error message

BOT_NOT_EXIST

What it means

After the parameter check, exportSkill loads the workflow by workflowId and throws BOT_NOT_EXIST if no workflow row is found. Despite the name, this response code is used here to mean 'workflow not found' for the given workflowId, before the space-permission check runs.

Solutions

  1. Verify workflowId exists via the workflow list/detail API for the current space.
  2. Re-select the workflow in the UI so the client sends a fresh, valid workflowId.
  3. Check you are pointed at the correct environment/database (test vs production ids).
  4. If the workflow was deleted, recreate or restore it before exporting a skill.

Example fix

// before
exportSkill({botId: 123, workflowId: 999999}); // deleted workflow
// after
const wf = await workflowApi.getById(999999);
if (wf) exportSkill({botId: 123, workflowId: wf.id}); else showMessage('workflow not found');
Defensive patterns

Strategy: validation

Validate before calling

Workflow wf = workflowService.getById(workflowId);
if (wf == null) {
    throw new IllegalStateException("workflow " + workflowId + " does not exist in this space");
}

Type guard

boolean workflowExists(Long workflowId) {
    return workflowId != null && workflowService.getById(workflowId) != null;
}

Try / catch

try {
    return exportSkill(request);
} catch (BusinessException e) {
    if ("BOT_NOT_EXIST".equals(e.getCode())) {
        refreshWorkflowList(); // id stale or deleted
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling exportSkill with a workflowId that does not exist in the workflow table — deleted workflow, wrong ID, or an ID from another environment/database.

Common situations: Client cached an old workflowId after the workflow was deleted; id copied from a different space or test environment; typo or truncation of a numeric id in a hand-built request.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/workflow/impl/WorkflowSkillExportServiceImpl.java:59

    private static final int METADATA_GENERATION_TIMEOUT_SECONDS = 8;
    private static final int SKILL_NAME_MAX_LENGTH = 64;
    private static final int SKILL_DESCRIPTION_MAX_LENGTH = 1024;
    private static final String SKILL_FILE_NAME = "SKILL.md";

    private final WorkflowService workflowService;
    private final PublishApiService publishApiService;
    private final OpenAiModelProcessService openAiModelProcessService;
    private final DataPermissionCheckTool dataPermissionCheckTool;

    @Override
    public WorkflowSkillExportResponse exportSkill(WorkflowSkillExportRequest request) {
        if (request == null || request.getBotId() == null || request.getWorkflowId() == null) {
            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);
        }

        Workflow workflow = workflowService.getById(request.getWorkflowId());
        if (workflow == null) {
            throw new BusinessException(ResponseEnum.BOT_NOT_EXIST);
        }
        dataPermissionCheckTool.checkWorkflowBelong(workflow, SpaceInfoUtil.getSpaceId());

        String workflowName = StringUtils.defaultIfBlank(request.getWorkflowName(), workflow.getName());
        String workflowDescription =
                StringUtils.defaultIfBlank(request.getWorkflowDescription(), workflow.getDescription());
        if (StringUtils.isBlank(workflowName) || StringUtils.isBlank(workflowDescription)) {
            throw new BusinessException(ResponseEnum.WORKFLOW_SKILL_NAME_DESC_EMPTY);
        }

        BotApiInfoDTO apiInfo = publishApiService.getApiInfo(request.getBotId());
        if (!hasPublishedApi(apiInfo)) {
            throw new BusinessException(ResponseEnum.WORKFLOW_SKILL_API_NOT_READY);
        }

        List<BizInputOutput> inputs = extractWorkflowInputs(workflow);
        SkillMetadata metadata = generateSkillMetadata(workflowName, workflowDescription, workflow.getId());
        String content = buildSkillContent(metadata, workflowName, workflowDescription, apiInfo, inputs);

View on GitHub (pinned to 5e758547a8)