iflytek/astron-agent · warning · BusinessException

8732

8732

Error message

repo.knowledge.tag.too.long

What it means

BusinessException thrown by KnowledgeController.updateKnowledge when any tag in the knowledge VO exceeds 30 characters. The controller validates each string in knowledgeVO.getTags() before delegating to knowledgeService, rejecting the whole update if a single tag is too long. It is a client-input validation error (code 8732, message 'repo.knowledge.tag.too.long').

Solutions

  1. Shorten every tag in the tags array to 30 characters or fewer before calling the API.
  2. Truncate or split long tags client-side before submitting the update.
  3. If a longer tag is legitimately needed, raise the limit in KnowledgeController.updateKnowledge and any persisted-column width accordingly.
  4. Return a clearer message naming the offending tag and its length in the error response.

Example fix

// before
knowledge.setTags(Arrays.asList("marketing-campaign-2026-q3-automated-segmentation-dashboard"));
// after
String tag = "marketing-campaign-2026-q3-automated-segmentation-dashboard";
knowledge.setTags(Arrays.asList(tag.length() > 30 ? tag.substring(0, 30) : tag));
Defensive patterns

Strategy: validation

Validate before calling

function canSubmitKnowledge(vo) {
  return !vo.tags || vo.tags.every(t => typeof t === 'string' && t.length <= 30);
}

Type guard

const isValidTag = (t: unknown): t is string => typeof t === 'string' && t.length > 0 && t.length <= 30;

Try / catch

try {
  await api.updateKnowledge(vo);
} catch (e) {
  if (e.code === 8732) {
    vo.tags = vo.tags.map(t => t.slice(0, 30));
    await api.updateKnowledge(vo);
  } else throw e;
}

Prevention

When it happens

Trigger: PUT/POST to the knowledge update endpoint with a request body whose tags array contains any string with length > 30 characters, e.g. {"tags":["a-very-long-tag-name-that-exceeds-thirty-characters"]}.

Common situations: Frontend forms without maxlength on the tag input; pasted labels or auto-generated tags (file names, UUIDs) longer than 30 chars; API consumers integrating directly without knowing the tag length cap.

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/d5700dc8b3f955bf. Report an issue: GitHub.

Appendix: source

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

    }

    /**
     * Update knowledge
     *
     * @param knowledgeVO knowledge update request object containing updated knowledge details
     * @return ApiResult<Knowledge> containing the updated knowledge information
     * @throws ExecutionException if the computation threw an exception
     * @throws InterruptedException if the thread is interrupted
     * @throws BusinessException if tag length exceeds 30 characters
     */
    @PostMapping("/update-knowledge")
    @SpacePreAuth(key = "KnowledgeController_updateKnowledge_POST",
            module = "Knowledge", point = "Update Knowledge", description = "Update Knowledge")
    public ApiResult<Knowledge> updateKnowledge(@RequestBody KnowledgeVO knowledgeVO) throws ExecutionException, InterruptedException {
        if (CollectionUtils.isNotEmpty(knowledgeVO.getTags())) {
            for (String tag : knowledgeVO.getTags()) {
                if (tag.length() > 30) {
                    throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_TAG_TOO_LONG);
                }
            }
        }
        return ApiResult.success(knowledgeService.updateKnowledge(knowledgeVO));
    }

    /**
     * Enable or disable knowledge
     *
     * @param id knowledge ID to be enabled or disabled
     * @param enabled status flag: 1 to enable, 0 to disable
     * @return ApiResult<String> containing operation result message
     * @throws ExecutionException if the computation threw an exception
     * @throws InterruptedException if the thread is interrupted
     */
    @PutMapping("/enable-knowledge")
    @SpacePreAuth(key = "KnowledgeController_enableKnowledge_PUT",
            module = "Knowledge", point = "Enable Knowledge", description = "Enable Knowledge")

View on GitHub (pinned to 5e758547a8)