iflytek/astron-agent · error · BusinessException

REPO_KNOWLEDGE_NO_TASK

REPO_KNOWLEDGE_NO_TASK

Error message

ResponseEnum.REPO_KNOWLEDGE_NO_TASK

What it means

BusinessException REPO_KNOWLEDGE_NO_TASK thrown by dealTaskForKnowledgeExtract when the callback's taskId has no matching ExtractKnowledgeTask row, or the matching task's status is not 0 (pending). The method is @Retryable, so a BusinessException here is retried (5s backoff) — but for a genuinely unknown/completed task the retry only repeats the failure. It guards against processing callbacks for tasks that don't exist or were already handled.

Solutions

  1. Check task existence and status: SELECT * FROM extract_knowledge_task WHERE task_id = '<taskId>'.
  2. If status != 0 the task was already processed — treat the callback as a duplicate and have the caller stop retrying (the @Retryable will re-fail otherwise).
  3. Fix callback routing so each environment receives only its own taskIds.
  4. If the task should exist, verify it wasn't purged by retention jobs and re-submit the extraction job.

Example fix

// before
if (extractKnowledgeTask == null || extractKnowledgeTask.getStatus() != 0) {
    throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_NO_TASK); // retried 5x even for duplicates
}
// after (idempotent no-op for duplicates)
if (extractKnowledgeTask == null) { throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_NO_TASK); }
if (extractKnowledgeTask.getStatus() != 0) {
    log.info("task {} already processed (status={}), ignoring duplicate callback", taskId, extractKnowledgeTask.getStatus());
    return;
}
Defensive patterns

Strategy: validation

Validate before calling

ExtractKnowledgeTask t = extractKnowledgeTaskService.getOne(
    new LambdaQueryWrapper<ExtractKnowledgeTask>().eq(ExtractKnowledgeTask::getTaskId, taskId));
if (t == null || t.getStatus() != 0) { ignoreCallback(taskId); return; }

Try / catch

try { dealTaskForKnowledgeExtract(result); } catch (BusinessException e) { if ("REPO_KNOWLEDGE_NO_TASK".equals(e.getCode())) { log.info("unknown/duplicate task callback {}", result.getString("taskId")); } else { throw e; } }

Prevention

When it happens

Trigger: Knowledge-extraction callback arrives with a taskId that: was never created in this environment (misrouted callback), references a task already processed (status != 0, duplicate callback delivery), or references a task row deleted/purged before the callback arrived.

Common situations: Callback URL configured to point at the wrong environment (staging callback hitting prod). Message-queue redelivery or upstream retrying a callback after success. Task rows cleaned by a retention job while the external extractor still runs. Clock/latency causing duplicate callback processing.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/KnowledgeService.java:1330

        // }
    }


    /**
     * Handle callback result for knowledge extraction task with retry mechanism
     *
     * @param retResult JSON object containing the callback result with task status and data
     * @throws BusinessException if task not found or processing fails
     */
    @Retryable(value = Exception.class, backoff = @Backoff(delay = 5000, multiplier = 1, maxDelay = 10000))
    public void dealTaskForKnowledgeExtract(JSONObject retResult) {
        log.info("dealTaskForKnowledgeExtract callback result:{}", JSONObject.toJSONString(retResult));
        // 1. Query task
        String taskId = retResult.getString("taskId");
        ExtractKnowledgeTask extractKnowledgeTask = extractKnowledgeTaskService.getOnly(Wrappers.lambdaQuery(ExtractKnowledgeTask.class).eq(ExtractKnowledgeTask::getTaskId, taskId));
        if (extractKnowledgeTask == null || extractKnowledgeTask.getStatus() != 0) {
            log.error("No corresponding task found: " + taskId);
            throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_NO_TASK);
        }

        boolean success = retResult.getBooleanValue("success");
        // If successful, parse knowledge points and store in database
        String resultTextUrl = retResult.getString("knowledgeUrl");
        this.downloadKnowLedgeData(resultTextUrl, extractKnowledgeTask, success, retResult.getString("err"));
    }


    /**
     * Download and process knowledge data from a given URL
     *
     * @param url the URL to download knowledge data from
     * @param extractKnowledgeTask the extraction task object to be updated
     * @param isSuccess boolean flag indicating if the extraction was successful
     * @param errMsg error message if extraction failed, null if successful
     * @throws BusinessException if file not found, download fails, or data processing fails
     */

View on GitHub (pinned to 5e758547a8)