iflytek/astron-agent · error · BusinessException

8308

8308

Error message

toolbox.param.and.desc.cannot.empty

What it means

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.

Solutions

  1. Add both "paramName" and "description" to the request JSON and ensure neither is an empty string
  2. Fix the frontend form to make paramName and description required fields before submit
  3. Check any importer/generator that builds the tool JSON so it always emits both fields

Example fix

// before
{"paramName":"city"}
// after
{"paramName":"city","description":"City name to query weather for"}
Defensive patterns

Strategy: validation

Validate before calling

if (payload == null || isBlank(payload.getParamName()) || isBlank(payload.getDescription())) { throw new IllegalArgumentException("paramName and description are required"); }

Type guard

boolean hasParamAndDesc(JsonObject o) { return o != null && !o.getString("paramName", "").isEmpty() && !o.getString("description", "").isEmpty(); }

Try / catch

try { toolboxApi.saveParam(payload); } catch (BusinessException e) { if (e.getCode() == 8308) { /* show 'name and description required' */ } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/103abc27fbfe6b3c. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java:1585

    /**
     * Validate parameter basic information
     */
    private void validateParamBasicInfo(JSONObject jsonObject, Integer previewType) {
        String type = jsonObject.getString("type");
        if (StringUtils.isEmpty(type)) {
            throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_CANNOT_EMPTY);
        }

        String params = jsonObject.getString("title");
        if (previewType == 0 && StringUtils.isEmpty(params)) {
            throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_CANNOT_EMPTY);
        }

        String title = jsonObject.getString("paramName");
        String description = jsonObject.getString("description");
        if (StringUtils.isEmpty(title) || StringUtils.isEmpty(description)) {
            throw new BusinessException(ResponseEnum.TOOLBOX_PARAM_AND_DESC_CANNOT_EMPTY);
        }
    }

    /**
     * Determine if it is a simple type
     */
    private boolean isSimpleType(String type) {
        return STRING.equals(type) || NUMBER.equals(type) || BOOLEAN.equals(type);
    }

    /**
     * Determine if it is a complex type
     */
    private boolean isComplexType(String type) {
        return OBJECT.equals(type) || ARRAY.equals(type);
    }

    /**

View on GitHub (pinned to 5e758547a8)