{"record":{"id":"6f6680882d71b5f6","repo":"alibaba/spring-ai-alibaba","slug":"invalid-params-6f6680","errorCode":"INVALID_PARAMS","errorMessage":"The parameters of the loop node do not conform to the array format.","messagePattern":"The parameters of the loop node do not conform to the array format\\.","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/processor/impl/IteratorExecuteProcessor.java","lineNumber":669,"sourceCode":"\t */\n\tprivate Map<String, List<Object>> buildItemMap(List<Node.InputParam> paramsArray, WorkflowContext context) {\n\t\tMap<String, List<Object>> params = Maps.newHashMap();\n\n\t\tif (Objects.isNull(paramsArray)) {\n\t\t\treturn params;\n\t\t}\n\t\tObjectMapper objectMapper = new ObjectMapper();\n\t\tparamsArray.forEach(param -> {\n\t\t\tString valueFromRequestContext = VariableUtils.getValueStringFromContext(param, context);\n\t\t\t// Convert JSON string to Map\n\t\t\tList<Object> list;\n\t\t\ttry {\n\t\t\t\tlist = objectMapper.readValue(valueFromRequestContext,\n\t\t\t\t\t\tnew com.fasterxml.jackson.core.type.TypeReference<List<Object>>() {\n\t\t\t\t\t\t});\n\t\t\t}\n\t\t\tcatch (JsonProcessingException e) {\n\t\t\t\tthrow new BizException(ErrorCode.INVALID_PARAMS.toError(\"input_params\",\n\t\t\t\t\t\t\"The parameters of the loop node do not conform to the array format.\"));\n\t\t\t}\n\t\t\tparams.put(param.getKey(), list);\n\t\t});\n\t\treturn params;\n\t}\n\n\t/**\n\t * Builds a map of variables for iteration\n\t * @param paramsArray List of input parameters\n\t * @param context The workflow context\n\t * @return Map of variables for iteration\n\t */\n\tprivate Map<String, Object> buildVariableMap(List<Node.InputParam> paramsArray, WorkflowContext context) {\n\t\tMap<String, Object> params = Maps.newHashMap();\n\n\t\tif (Objects.isNull(paramsArray)) {\n\t\t\treturn params;","sourceCodeStart":651,"sourceCodeEnd":687,"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/processor/impl/IteratorExecuteProcessor.java#L651-L687","documentation":"IteratorExecuteProcessor.buildItemMap() deserializes each loop-node input parameter value into List<Object> using Jackson. If the value from the request context is not a JSON array, JsonProcessingException is caught and rethrown as BizException INVALID_PARAMS: the loop node's parameter doesn't conform to array format.","triggerScenarios":"A loop/iterator node's input parameter (e.g. array-type input) resolves to a scalar, object, or malformed string instead of a JSON array when itemListMap calls buildItemMap.","commonSituations":"Upstream node outputs a single object instead of a list; a variable reference points at the wrong field; user typed a comma-separated string instead of configuring an array; JSON escaping issues in the configured literal.","solutions":["Inspect the actual value (log valueFromRequestContext) and ensure it is a JSON array like [1,2,3] or [{...},{...}]","Fix the upstream node's output to emit an array, or wrap it (e.g. code node: return [value];)","Correct the loop node's input configuration to reference the array field, not a scalar field","If the input is a literal, write it as valid JSON array syntax in the designer"],"exampleFix":"// before (loop input literal)\n{\"array\": \"a,b,c\"}\n// after\n{\"array\": [\"a\", \"b\", \"c\"]}","handlingStrategy":"validation","validationCode":"Object v = context.get(paramKey);\nboolean isArray = (v instanceof List<?>)\n    || (v instanceof String s && s.trim().startsWith(\"[\") && s.trim().endsWith(\"]\"));\nif (!isArray) throw new IllegalStateException(\"Loop input must be an array, got: \" + v);","typeGuard":"static boolean isJsonArrayValue(Object v) {\n    if (v instanceof List<?>) return true;\n    if (v instanceof String s) {\n        String t = s.trim();\n        return t.startsWith(\"[\") && t.endsWith(\"]\");\n    }\n    return false;\n}","tryCatchPattern":"try {\n    processor.execute(graph, node, context);\n} catch (BizException e) {\n    if (ErrorCode.INVALID_PARAMS.getCode().equals(e.getCode()) && e.getMessage().contains(\"array format\")) {\n        log.error(\"Loop node input is not an array; check upstream output/variable mapping\");\n    }\n    throw e;\n}","preventionTips":["Confirm upstream nodes emit JSON arrays for loop inputs","Use array-typed variables in the designer for loop item sources","Wrap scalars in a list via a code node before iterating","Log the raw parameter value when debugging loop configs"],"tags":["workflow","loop","json","type-mismatch"],"backgroundTag":"type-mismatch","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"}