{"record":{"id":"46cbb2a8a9d6408b","repo":"iflytek/astron-agent","slug":"generate-workflow-template-cover-failed-workflowid","errorCode":null,"errorMessage":"Generate workflow template cover failed, workflowId={}","messagePattern":"Generate workflow template cover failed, workflowId=(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/workflow/impl/BotMaasServiceImpl.java","lineNumber":361,"sourceCode":"            log.error(\"Export workflow template snapshot failed, workflowId={}\", workflow.getId(), e);\n            throw new BusinessException(ResponseEnum.WORKFLOW_EXPORT_FAILED);\n        }\n    }\n\n    private String generateTemplateCover(String uid, Workflow workflow) {\n        String fallbackCover = workflow.getAvatarIcon();\n        try {\n            String coverUrl = CompletableFuture\n                    .supplyAsync(() -> botAIService.generateAvatar(uid, workflow.getName(), workflow.getDescription()))\n                    .orTimeout(TEMPLATE_COVER_TIMEOUT_SECONDS, TimeUnit.SECONDS)\n                    .exceptionally(ex -> null)\n                    .join();\n            if (StringUtils.isBlank(coverUrl) || AI_AVATAR_FALLBACK.equals(coverUrl)) {\n                return fallbackCover;\n            }\n            return coverUrl;\n        } catch (Exception e) {\n            log.warn(\"Generate workflow template cover failed, workflowId={}\", workflow.getId(), e);\n            return fallbackCover;\n        }\n    }\n\n    private LambdaQueryWrapper<ExportedWorkflowTemplate> withSpaceScope(LambdaQueryWrapper<ExportedWorkflowTemplate> queryWrapper) {\n        Long spaceId = SpaceInfoUtil.getSpaceId();\n        if (spaceId == null) {\n            queryWrapper.isNull(ExportedWorkflowTemplate::getSpaceId);\n        } else {\n            queryWrapper.eq(ExportedWorkflowTemplate::getSpaceId, spaceId);\n        }\n        return queryWrapper;\n    }\n}\n","sourceCodeStart":343,"sourceCodeEnd":376,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/workflow/impl/BotMaasServiceImpl.java#L343-L376","documentation":"generateTemplateCover calls an AI model asynchronously to generate a cover image for a workflow template being exported. If any step of that async generation (or cover upload) throws, the method logs a warning with the workflow ID and returns a static fallbackCover so template export still succeeds. This is a deliberate degraded-mode path, not a thrown exception.","triggerScenarios":"exportTemplate -> generateTemplateCover when the remote AI image-generation call throws (model unavailable, timeout, auth failure), the CompletableFuture join() wraps an exception, or the returned cover URL is blank or equals the AI_AVATAR_FALLBACK sentinel after a successful call.","commonSituations":"AI model service down or rate-limited during template export; slow generation exceeding the join timeout; image upload endpoint misconfigured; model returns the fallback sentinel meaning generation was rejected.","solutions":["Check the stack trace logged at warn level for the root cause (connect/timeout/auth) and fix the AI service connectivity or credentials","Verify the image generation model is configured and healthy for the space the bot belongs to","Confirm the fallback cover is acceptable UX; if export must fail when no cover is generated, change this to rethrow","Retry the export once the AI service is available so a real cover is produced"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// caller-side pre-check before export\nif (!aiServiceHealthCheck()) {\n    log.info(\"AI service unavailable, export will use fallback cover\");\n}","typeGuard":"if (coverUrl == null || coverUrl.isBlank() || AI_AVATAR_FALLBACK.equals(coverUrl)) { return fallbackCover; }","tryCatchPattern":"try {\n    String url = generateCoverAsync(workflow).orTimeout(30, TimeUnit.SECONDS).join();\n    return StringUtils.isNotBlank(url) && !AI_AVATAR_FALLBACK.equals(url) ? url : fallbackCover;\n} catch (Exception e) {\n    log.warn(\"Generate workflow template cover failed, workflowId={}\", workflow.getId(), e);\n    return fallbackCover;\n}","preventionTips":["Health-check the image generation service before bulk template exports","Set an explicit timeout shorter than the export request timeout so the fallback is reached gracefully","Monitor warn logs for this message to detect persistent AI-service degradation","Ensure workflows have a sensible default cover so degraded exports are still usable"],"tags":["java","ai-image-generation","fallback","export"],"backgroundTag":"upstream-api-error","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"}