{"record":{"id":"9f3410026c7ee671","repo":"iflytek/astron-agent","slug":"8310-toolbox-param-type-not-match","errorCode":"8310","errorMessage":"toolbox.param.type.not.match","messagePattern":"toolbox\\.param\\.type\\.not\\.match","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java","lineNumber":1564,"sourceCode":"\n    /**\n     * Process single parameter\n     */\n    private void processParam(JSONObject jsonObject, JSONObject targetObject, Integer previewType, boolean input) {\n        // Validate parameter basic information\n        validateParamBasicInfo(jsonObject, previewType);\n\n        String type = jsonObject.getString(\"type\");\n        String params = jsonObject.getString(\"title\");\n        String title = jsonObject.getString(\"paramName\");\n        String description = jsonObject.getString(\"description\");\n\n        if (isSimpleType(type)) {\n            processSimpleTypeParam(jsonObject, targetObject, params, title, description, type, input);\n        } else if (isComplexType(type)) {\n            processComplexTypeParam(jsonObject, targetObject, previewType, params, title, description, type, input);\n        } else {\n            throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_TYPE_NOT_MATCH);\n        }\n    }\n\n    /**\n     * Validate parameter basic information\n     */\n    private void validateParamBasicInfo(JSONObject jsonObject, Integer previewType) {\n        String type = jsonObject.getString(\"type\");\n        if (StringUtils.isEmpty(type)) {\n            throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_CANNOT_EMPTY);\n        }\n\n        String params = jsonObject.getString(\"title\");\n        if (previewType == 0 && StringUtils.isEmpty(params)) {\n            throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_CANNOT_EMPTY);\n        }\n\n        String title = jsonObject.getString(\"paramName\");","sourceCodeStart":1546,"sourceCodeEnd":1582,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java#L1546-L1582","documentation":"Thrown by ToolBoxService when a parameter's declared \"type\" is neither one of the recognized simple types nor one of the recognized complex types. The dispatcher (processSimpleTypeParam / processComplexTypeParam) has no handler for it, so the parameter schema is rejected as having an invalid type name.","triggerScenarios":"Saving/processing a tool parameter whose \"type\" string is not in the service's recognized set — e.g. a typo (\"nunmber\", \"str\"), a wrong-cased value (\"Number\"), or a type introduced by a newer API version not supported by this service build.","commonSituations":"Manual JSON schema editing; tools exported from a different version/platform with extended type names; locale or case mistakes when typing the type.","solutions":["Correct the \"type\" value to a supported simple type (STRING, NUMBER, INTEGER, BOOLEAN) or a supported complex type (e.g. OBJECT, ARRAY) exactly as the API expects.","Check isSimpleType/isComplexType in ToolBoxService for the exact accepted type strings and case sensitivity.","If the type came from an export of a newer platform version, upgrade or remap it to a supported type.","Add client-side validation against the allowed type list before submitting the schema."],"exampleFix":"// before\n{\"paramName\": \"timeout\", \"type\": \"num\"}\n// after\n{\"paramName\": \"timeout\", \"type\": \"NUMBER\"}","handlingStrategy":"validation","validationCode":"Set<String> allowed = Set.of(\"STRING\", \"NUMBER\", \"INTEGER\", \"BOOLEAN\", \"OBJECT\", \"ARRAY\");\nfor (JSONObject p : paramArray) {\n    String t = p.getString(\"type\");\n    if (t != null && !allowed.contains(t)) {\n        throw new IllegalArgumentException(\"Unsupported param type: \" + t);\n    }\n}","typeGuard":"boolean isKnownType(String t) {\n    return t != null && Set.of(\"STRING\", \"NUMBER\", \"INTEGER\", \"BOOLEAN\", \"OBJECT\", \"ARRAY\").contains(t);\n}","tryCatchPattern":"try {\n    toolBoxService.saveToolSchema(paramArray);\n} catch (BusinessException e) {\n    if (\"TOOLBOX_PARAM_TYPE_NOT_MATCH\".equals(String.valueOf(e.getCode()))) {\n        // map the unknown type to the nearest supported one and resubmit\n    }\n}","preventionTips":["Validate types against the service's isSimpleType/isComplexType sets (exact casing) before submit.","Remap types from exports of other platform versions to supported values.","Use a dropdown, not free text, for the type field."],"tags":["java","schema-validation","toolbox","enum"],"backgroundTag":"invalid-enum-value","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"}