{"record":{"id":"098af971f95dfa60","repo":"alibaba/spring-ai-alibaba","slug":"missing-params-098af9","errorCode":"MISSING_PARAMS","errorMessage":"request or appId is null","messagePattern":"request or appId is null","errorType":"error_code","errorClass":"BizException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/workflow/runtime/WorkflowExecuteManager.java","lineNumber":130,"sourceCode":"\t\tWorkflowContext context = workflowInnerService.getContextCache(requestContext.getWorkspaceId(), taskId);\n\t\tif (context == null) {\n\t\t\treturn false;\n\t\t}\n\n\t\tcontext.setTaskStatus(NodeStatusEnum.STOP.getCode());\n\t\tcontext.setError(ErrorCode.WORKFLOW_RUN_CANCEL.toError(\"Manually terminated\"));\n\n\t\tworkflowInnerService.refreshContextCache(context);\n\t\treturn true;\n\t}\n\n\tpublic TaskRunResponse runTask(ApplicationVersion appVersion, List<TaskRunParam> inputParams, String conversationId,\n\t\t\tWorkflowContext workflowContext) {\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\tif (appVersion == null) {\n\t\t\tLogUtils.monitor(\"WorkflowExecuteManager\", \"runTask\", System.currentTimeMillis(), FAIL, inputParams,\n\t\t\t\t\t\"request or appId is null\");\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"request or appId is null\"));\n\t\t}\n\t\t// Initialize context\n\t\tinputParams.forEach(input -> {\n\t\t\tString key = input.getKey();\n\t\t\tString source = input.getSource();\n\t\t\tif (\"sys\".equals(source)) {\n\t\t\t\tworkflowContext.getSysMap()\n\t\t\t\t\t.put(key, VariableUtils.convertValueByType(input.getKey(), input.getType(), input.getValue()));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tworkflowContext.getUserMap()\n\t\t\t\t\t.put(key, VariableUtils.convertValueByType(input.getKey(), input.getType(), input.getValue()));\n\t\t\t}\n\t\t});\n\n\t\tconversationId = conversationId == null ? IdGenerator.uuid() : conversationId;\n\n\t\tworkflowContext.setAppId(appVersion.getAppId());","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/workflow/runtime/WorkflowExecuteManager.java#L112-L148","documentation":"WorkflowExecuteManager.runTask validates that the resolved ApplicationVersion is non-null before initializing the workflow context. A null appVersion (no request context / no appId resolved) is rejected with MISSING_PARAMS; the log message hints the usual cause is a missing request or appId.","triggerScenarios":"Calling runTask (directly or via the workflow run API) with appVersion == null — e.g. the RequestContext/RequestContextHolder had no appId, or the appId passed in does not resolve to a published application version.","commonSituations":"Calling the execution API without the appId parameter; referencing an app id that was deleted or never published; invoking runTask programmatically/async where RequestContextHolder is not populated; unauthenticated calls bypassing the request-context interceptor.","solutions":["Ensure the run request includes a valid appId that resolves to a published application version.","Verify the RequestContext is populated (call through the normal HTTP path or set RequestContextHolder manually in tests/async tasks).","Confirm the application exists and is published; re-publish if the version record is missing.","Add an up-front null/empty check on appId in your client code before invoking the run API."],"exampleFix":"// before\nworkflowExecuteManager.runTask(appId, params, conversationId, ctx); // appVersion unresolved\n// after\nif (appId == null || appId.isBlank()) throw new IllegalArgumentException(\"appId is required\");\nworkflowExecuteManager.runTask(appService.getPublishedVersion(appId), params, conversationId, ctx);","handlingStrategy":"validation","validationCode":"if (appId == null || appId.isBlank()) throw new IllegalArgumentException(\"appId is required\");\nApplicationVersion v = appService.getPublishedVersion(appId);\nif (v == null) throw new IllegalArgumentException(\"no published version for appId \" + appId);","typeGuard":null,"tryCatchPattern":"try {\n    manager.runTask(appVersion, params, conversationId, ctx);\n} catch (BizException e) {\n    if (\"MISSING_PARAMS\".equals(e.getCode())) { /* missing/invalid appId in request */ }\n}","preventionTips":["Always include a valid appId in run requests and validate it client-side.","Call the workflow API through the normal request path so RequestContextHolder is populated; set it explicitly in async/test code.","Only run workflows against published application versions."],"tags":["workflow","missing-parameter","request-context","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}