{"record":{"id":"48631a04a37279ba","repo":"iflytek/astron-agent","slug":"data-not-found","errorCode":"DATA_NOT_FOUND","errorMessage":"DATA_NOT_FOUND","messagePattern":"DATA_NOT_FOUND","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/commons/src/main/java/com/iflytek/astron/console/commons/service/workflow/impl/WorkflowServiceImpl.java","lineNumber":44,"sourceCode":"    private UserLangChainDataService userLangChainDataService;\n\n    @Autowired\n    private RedissonClient redissonClient;\n\n    @Autowired\n    private ChatBotDataService chatBotDataService;\n\n    @Override\n    public Integer maasCopySynchronize(CloneSynchronize synchronize) {\n        String uid = synchronize.getUid();\n        Long originId = synchronize.getOriginId();\n        Long maasId = synchronize.getCurrentId();\n        String flowId = synchronize.getFlowId();\n        Long spaceId = synchronize.getSpaceId();\n        UserLangChainInfo info = userLangChainDataService.selectByMaasId(originId);\n        if (Objects.isNull(info)) {\n            log.error(\"----- unable to find workflow: {}\", JSONObject.toJSONString(synchronize));\n            throw new BusinessException(ResponseEnum.DATA_NOT_FOUND);\n        }\n        Integer botId = info.getBotId();\n        // If maasId already exists, end directly\n        if (redissonClient.getBucket(MaasUtil.generatePrefix(uid, botId)).isExists()) {\n            log.info(\"----- Xinghuo has obtained this workflow, ending task: {}\", JSONObject.toJSONString(synchronize));\n            redissonClient.getBucket(MaasUtil.generatePrefix(uid, botId)).delete();\n            return botId;\n        }\n        ChatBotBase base = chatBotDataService.copyBot(uid, botId, spaceId);\n        Long currentBotId = Long.valueOf(base.getId());\n        UserLangChainInfo userLangChainInfo = UserLangChainInfo.builder()\n                .id(currentBotId)\n                .botId(Math.toIntExact(currentBotId))\n                .maasId(maasId)\n                .flowId(flowId)\n                .uid(uid)\n                .updateTime(LocalDateTime.now())\n                .build();","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/commons/src/main/java/com/iflytek/astron/console/commons/service/workflow/impl/WorkflowServiceImpl.java#L26-L62","documentation":"BusinessException(ResponseEnum.DATA_NOT_FOUND) thrown by maasCopySynchronize when userLangChainDataService.selectByMaasId(originId) returns null. It means the MaaS sync task references an origin workflow ID that has no matching UserLangChainInfo record in the database, so the copy/synchronize flow cannot proceed. This is a lookup failure on internal workflow mapping data, not a client-input problem.","triggerScenarios":"Calling maasCopySynchronize with a synchronize DTO whose originId maps to no row in the user_lang_chain table (record deleted, wrong originId, or cross-space data never created). The check is Objects.isNull(info) right after the selectByMaasId call.","commonSituations":"Stale MaaS synchronization jobs running after the source workflow was deleted; environments where the sync data was seeded in one DB but the job runs against another; race between workflow deletion and queued sync tasks; manually crafted sync requests with an incorrect originId.","solutions":["Verify the originId exists: SELECT * FROM user_lang_chain WHERE maas_id = <originId>; re-seed or restore the mapping row if missing.","Confirm the sync task is targeting the correct datasource/space (spaceId) — the record may exist in another environment.","If the source workflow was legitimately deleted, cancel/skip the stale synchronization task instead of retrying it.","Re-trigger the synchronization after the workflow mapping has been recreated so selectByMaasId returns a valid record."],"exampleFix":"// before: blindly syncing with a possibly stale id\nworkflowService.maasCopySynchronize(synchronize);\n// after: pre-check existence and skip stale tasks\nUserLangChainInfo info = userLangChainDataService.selectByMaasId(originId);\nif (info == null) { log.warn(\"skip sync, no workflow for originId={}\", originId); return; }\nworkflowService.maasCopySynchronize(synchronize);","handlingStrategy":"try-catch","validationCode":"UserLangChainInfo info = userLangChainDataService.selectByMaasId(originId);\nif (info == null) { /* skip or re-seed before calling maasCopySynchronize */ }","typeGuard":null,"tryCatchPattern":"try { workflowService.maasCopySynchronize(synchronize); }\ncatch (BusinessException e) {\n    if (ResponseEnum.DATA_NOT_FOUND.equals(e.getResponseEnum())) {\n        log.warn(\"stale sync task, no workflow for originId={}\", synchronize.getOriginId()); // cancel/skip\n    } else { throw e; }\n}","preventionTips":["Delete or deactivate queued MaaS sync tasks whenever the source workflow is removed.","Foreign-key or existence check on maas_id before enqueuing synchronize jobs.","Log and monitor DATA_NOT_FOUND on sync jobs to detect orphaned tasks early."],"tags":["java","workflow","data-not-found","sync"],"backgroundTag":"record-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"}