{"record":{"id":"d3f709c058f9bf16","repo":"iflytek/astron-agent","slug":"parse-workflow-inputs-failed-workflowid","errorCode":null,"errorMessage":"Parse workflow inputs failed, workflowId={}","messagePattern":"Parse workflow inputs 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/WorkflowSkillExportServiceImpl.java","lineNumber":110,"sourceCode":"        if (StringUtils.isBlank(workflowProtocol)) {\n            return List.of();\n        }\n\n        try {\n            BizWorkflowData workflowData = JSON.parseObject(workflowProtocol, BizWorkflowData.class);\n            if (workflowData == null || workflowData.getNodes() == null) {\n                return List.of();\n            }\n            for (BizWorkflowNode node : workflowData.getNodes()) {\n                if (node != null\n                        && StringUtils.startsWith(node.getId(), WorkflowConst.NodeType.START)\n                        && node.getData() != null\n                        && node.getData().getOutputs() != null) {\n                    return node.getData().getOutputs();\n                }\n            }\n        } catch (Exception e) {\n            log.warn(\"Parse workflow inputs failed, workflowId={}\", workflow.getId(), e);\n        }\n        return List.of();\n    }\n\n    private SkillMetadata generateSkillMetadata(String workflowName, String workflowDescription, Long workflowId) {\n        SkillMetadata fallback = new SkillMetadata(\n                toSkillName(workflowName, workflowId),\n                toFallbackDescription(workflowName, workflowDescription),\n                false);\n\n        try {\n            String prompt = buildMetadataPrompt(workflowName, workflowDescription);\n            String content = CompletableFuture\n                    .supplyAsync(() -> openAiModelProcessService.processNonStreaming(prompt))\n                    .orTimeout(METADATA_GENERATION_TIMEOUT_SECONDS, TimeUnit.SECONDS)\n                    .exceptionally(ex -> {\n                        log.warn(\"Generate workflow skill metadata failed, workflowId={}\", workflowId, ex);\n                        return null;","sourceCodeStart":92,"sourceCodeEnd":128,"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#L92-L128","documentation":"extractWorkflowInputs walks the workflow's node graph to find the start node's outputs schema. Parsing/inspecting that structure is wrapped in a broad try-catch: on any exception (malformed JSON in node data, unexpected graph shape, nulls) it logs a warning with the workflowId and returns an empty list, so skill export proceeds without declared inputs.","triggerScenarios":"inputs() -> extractWorkflowInputs on a workflow whose definition JSON cannot be parsed or whose start-node data.outputs is missing/malformed — e.g. corrupt stored definition, nodes serialized by an older schema version, or hand-edited workflow data.","commonSituations":"Workflows imported from other environments with schema drift; definitions saved before an inputs/outputs schema change; manual DB edits breaking the JSON; DSL import from an incompatible astron version.","solutions":["Inspect the logged stack trace to find whether JSON parsing or graph traversal failed, then fix the workflow definition in the DB or via the editor","Re-save/re-publish the workflow so its definition is re-serialized with the current schema","Add schema validation on workflow import/save to reject malformed definitions early","If inputs are optional for the skill, accepting the empty-list fallback is fine; otherwise make this throw"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// validate workflow definition is parseable before export\ntry {\n    JsonNode def = objectMapper.readTree(workflow.getDefinition());\n    if (!def.hasNonNull(\"nodes\")) throw new IllegalArgumentException(\"Workflow has no nodes\");\n} catch (JsonProcessingException e) {\n    throw new IllegalArgumentException(\"Workflow definition is not valid JSON, fix before export\");\n}","typeGuard":"boolean hasStartOutputs(Workflow wf) {\n    return wf != null && wf.getNodes() != null && wf.getNodes().stream()\n        .anyMatch(n -> n != null && n.getData() != null && n.getData().getOutputs() != null);\n}","tryCatchPattern":"try {\n    return extractWorkflowInputs(workflow);\n} catch (Exception e) {\n    log.warn(\"Parse workflow inputs failed, workflowId={}\", workflow.getId(), e);\n    return List.of(); // or rethrow if inputs are mandatory\n}","preventionTips":["Validate workflow definition JSON on save/import with a schema validator","Re-publish workflows after engine schema upgrades to re-serialize definitions","Never hand-edit workflow definitions directly in the database","Add integration tests exporting workflows created by older schema versions"],"tags":["java","json","workflow-definition","export"],"backgroundTag":"json-parse-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"}