{"record":{"id":"103abc27fbfe6b3c","repo":"iflytek/astron-agent","slug":"8308-toolbox-param-and-desc-cannot-empty","errorCode":"8308","errorMessage":"toolbox.param.and.desc.cannot.empty","messagePattern":"toolbox\\.param\\.and\\.desc\\.cannot\\.empty","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":1585,"sourceCode":"\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\");\n        String description = jsonObject.getString(\"description\");\n        if (StringUtils.isEmpty(title) || StringUtils.isEmpty(description)) {\n            throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_AND_DESC_CANNOT_EMPTY);\n        }\n    }\n\n    /**\n     * Determine if it is a simple type\n     */\n    private boolean isSimpleType(String type) {\n        return STRING.equals(type) || NUMBER.equals(type) || BOOLEAN.equals(type);\n    }\n\n    /**\n     * Determine if it is a complex type\n     */\n    private boolean isComplexType(String type) {\n        return OBJECT.equals(type) || ARRAY.equals(type);\n    }\n\n    /**","sourceCodeStart":1567,"sourceCodeEnd":1603,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java#L1567-L1603","documentation":"ToolBoxService throws TOOLBOX_PARAM_CANNOT_EMPTY family error 8308 when a tool parameter entry is missing either its name (paramName) or its description. The service parses a JSON body and requires both fields to be non-empty strings so downstream tool schemas are meaningful. It is a pure server-side input validation guard thrown as a BusinessException.","triggerScenarios":"Calling a ToolBoxService API that adds/updates tool parameters with a JSON body whose \"paramName\" or \"description\" field is absent, null, or an empty string.","commonSituations":"Frontend forms that allow saving a parameter without filling the description; API clients testing the endpoint with minimal payloads; programmatic tool imports that omit one of the two fields.","solutions":["Add both \"paramName\" and \"description\" to the request JSON and ensure neither is an empty string","Fix the frontend form to make paramName and description required fields before submit","Check any importer/generator that builds the tool JSON so it always emits both fields"],"exampleFix":"// before\n{\"paramName\":\"city\"}\n// after\n{\"paramName\":\"city\",\"description\":\"City name to query weather for\"}","handlingStrategy":"validation","validationCode":"if (payload == null || isBlank(payload.getParamName()) || isBlank(payload.getDescription())) { throw new IllegalArgumentException(\"paramName and description are required\"); }","typeGuard":"boolean hasParamAndDesc(JsonObject o) { return o != null && !o.getString(\"paramName\", \"\").isEmpty() && !o.getString(\"description\", \"\").isEmpty(); }","tryCatchPattern":"try { toolboxApi.saveParam(payload); } catch (BusinessException e) { if (e.getCode() == 8308) { /* show 'name and description required' */ } else throw e; }","preventionTips":["Make paramName and description required fields in the UI form","Validate payload shape client-side before the API call","Add schema/bean validation on importers that generate tool JSON"],"tags":["java","spring-boot","validation","toolbox"],"backgroundTag":"empty-required-field","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"}