{"record":{"id":"500de51079801795","repo":"iflytek/astron-agent","slug":"bot-not-exist-500de5","errorCode":"BOT_NOT_EXIST","errorMessage":"BOT_NOT_EXIST","messagePattern":"BOT_NOT_EXIST","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/workflow/impl/WorkflowSkillExportServiceImpl.java","lineNumber":59,"sourceCode":"    private static final int METADATA_GENERATION_TIMEOUT_SECONDS = 8;\n    private static final int SKILL_NAME_MAX_LENGTH = 64;\n    private static final int SKILL_DESCRIPTION_MAX_LENGTH = 1024;\n    private static final String SKILL_FILE_NAME = \"SKILL.md\";\n\n    private final WorkflowService workflowService;\n    private final PublishApiService publishApiService;\n    private final OpenAiModelProcessService openAiModelProcessService;\n    private final DataPermissionCheckTool dataPermissionCheckTool;\n\n    @Override\n    public WorkflowSkillExportResponse exportSkill(WorkflowSkillExportRequest request) {\n        if (request == null || request.getBotId() == null || request.getWorkflowId() == null) {\n            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);\n        }\n\n        Workflow workflow = workflowService.getById(request.getWorkflowId());\n        if (workflow == null) {\n            throw new BusinessException(ResponseEnum.BOT_NOT_EXIST);\n        }\n        dataPermissionCheckTool.checkWorkflowBelong(workflow, SpaceInfoUtil.getSpaceId());\n\n        String workflowName = StringUtils.defaultIfBlank(request.getWorkflowName(), workflow.getName());\n        String workflowDescription =\n                StringUtils.defaultIfBlank(request.getWorkflowDescription(), workflow.getDescription());\n        if (StringUtils.isBlank(workflowName) || StringUtils.isBlank(workflowDescription)) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_SKILL_NAME_DESC_EMPTY);\n        }\n\n        BotApiInfoDTO apiInfo = publishApiService.getApiInfo(request.getBotId());\n        if (!hasPublishedApi(apiInfo)) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_SKILL_API_NOT_READY);\n        }\n\n        List<BizInputOutput> inputs = extractWorkflowInputs(workflow);\n        SkillMetadata metadata = generateSkillMetadata(workflowName, workflowDescription, workflow.getId());\n        String content = buildSkillContent(metadata, workflowName, workflowDescription, apiInfo, inputs);","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/workflow/impl/WorkflowSkillExportServiceImpl.java#L41-L77","documentation":"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.","triggerScenarios":"Calling exportSkill with a workflowId that does not exist in the workflow table — deleted workflow, wrong ID, or an ID from another environment/database.","commonSituations":"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.","solutions":["Verify workflowId exists via the workflow list/detail API for the current space.","Re-select the workflow in the UI so the client sends a fresh, valid workflowId.","Check you are pointed at the correct environment/database (test vs production ids).","If the workflow was deleted, recreate or restore it before exporting a skill."],"exampleFix":"// before\nexportSkill({botId: 123, workflowId: 999999}); // deleted workflow\n// after\nconst wf = await workflowApi.getById(999999);\nif (wf) exportSkill({botId: 123, workflowId: wf.id}); else showMessage('workflow not found');","handlingStrategy":"validation","validationCode":"Workflow wf = workflowService.getById(workflowId);\nif (wf == null) {\n    throw new IllegalStateException(\"workflow \" + workflowId + \" does not exist in this space\");\n}","typeGuard":"boolean workflowExists(Long workflowId) {\n    return workflowId != null && workflowService.getById(workflowId) != null;\n}","tryCatchPattern":"try {\n    return exportSkill(request);\n} catch (BusinessException e) {\n    if (\"BOT_NOT_EXIST\".equals(e.getCode())) {\n        refreshWorkflowList(); // id stale or deleted\n    }\n    throw e;\n}","preventionTips":["Re-fetch workflow ids from the list API instead of caching them","Confirm the same environment (test vs prod) when reusing ids","Delete client-side references when a workflow is removed"],"tags":["not-found","workflow","entity-lookup","java"],"backgroundTag":"entity-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}