iflytek/astron-agent · warning · BusinessException

8732

8732

Error message

repo.knowledge.tag.too.long

What it means

FileController.createFolder validates each tag in the CreateFolderVO payload before creating the folder; any tag longer than 30 characters throws BusinessException(ResponseEnum.REPO_KNOWLEDGE_TAG_TOO_LONG, code 8732) with the message key 'repo.knowledge.tag.too.long'. It enforces the knowledge-base folder tag length limit before any persistence happens.

Solutions

  1. Trim or shorten each tag to 30 characters or fewer before calling createFolder.
  2. Add a 30-character maxlength validation on tag inputs in the frontend.
  3. Strip whitespace and reject empty tags too, to avoid redundant failures.
  4. If tags are auto-generated from names/descriptions, truncate them programmatically before sending.

Example fix

// before
await api.post('/create-folder', { name, tags: userTags }); // may exceed 30 chars
// after
const safeTags = userTags.map(t => t.trim().slice(0, 30)).filter(Boolean);
await api.post('/create-folder', { name, tags: safeTags });
Defensive patterns

Strategy: validation

Validate before calling

if (tags?.some(t => t.length > 30)) { alert('Each tag must be 30 characters or fewer'); return; }

Type guard

function tagsWithinLimit(tags, max = 30) { return Array.isArray(tags) && tags.every(t => typeof t === 'string' && t.length <= max); }

Try / catch

try { await api.createFolder(vo); } catch (BusinessException e) { if (e.getCode() == 8732) { showToast("Tag exceeds 30 characters"); } else throw e; }

Prevention

When it happens

Trigger: POSTing to /create-folder with a body whose tags array contains at least one string whose length() exceeds 30 characters (counted in Java chars, not bytes/graphemes).

Common situations: Users pasting long phrases or whole sentences as tags in the UI; front-end lacking a 30-char maxlength on tag inputs; CJK or emoji tags where developers misjudge limits (emoji count as 2 Java chars); API clients sending unbounded tag arrays from scripts.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/knowledge/FileController.java:265

            @RequestParam(value = "isRepoPage", defaultValue = "1") Integer isRepoPage,
            HttpServletRequest request) {
        return fileInfoV2Service.queryFileList(repoId, parentId, pageNo, pageSize, tag, request, isRepoPage);
    }

    /**
     * Create a new folder in the specified repository and parent directory Validates that tag length
     * does not exceed 30 characters
     *
     * @param folderVO the folder creation request object containing folder name, parent ID, and tags
     * @return ApiResult with void data indicating successful folder creation
     * @throws BusinessException when tag length exceeds 30 characters or folder creation fails
     */
    @PostMapping("/create-folder")
    public ApiResult<Void> createFolder(@RequestBody CreateFolderVO folderVO) {
        if (CollectionUtils.isNotEmpty(folderVO.getTags())) {
            for (String tag : folderVO.getTags()) {
                if (tag.length() > 30) {
                    throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_TAG_TOO_LONG);
                }
            }
        }

        fileInfoV2Service.createFolder(folderVO);
        return ApiResult.success();
    }

    /**
     * Update existing folder properties such as name, tags, or metadata
     *
     * @param folderVO the folder update request object containing folder ID and updated properties
     * @return ApiResult with void data indicating successful folder update
     * @throws BusinessException when folder update fails or folder is not found
     */
    @PostMapping("/update-folder")
    public ApiResult<Void> updateFolder(@RequestBody CreateFolderVO folderVO) {
        fileInfoV2Service.updateFolder(folderVO);

View on GitHub (pinned to 5e758547a8)