{"record":{"id":"a5faa93dba322ded","repo":"yikart/AiToEarn","slug":"invalidaitaskid-a5faa9","errorCode":"InvalidAiTaskId","errorMessage":"ResponseCode.InvalidAiTaskId","messagePattern":"ResponseCode\\.InvalidAiTaskId","errorType":"error_code","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/volcengine/volcengine.service.ts","lineNumber":282,"sourceCode":"      request: normalized.aiLogRequest,\n      status: AiLogStatus.Generating,\n    })\n\n    return {\n      ...result,\n      id: aiLog.id,\n    } as CreateVideoGenerationTaskResponse\n  }\n\n  /**\n   * Volcengine回调处理\n   */\n  async callback(callbackData: GetVideoGenerationTaskResponse) {\n    const { id, status, updated_at, content } = callbackData\n\n    const aiLog = await this.aiLogRepo.getByTaskId(id)\n    if (!aiLog || aiLog.channel !== AiLogChannel.Volcengine) {\n      throw new AppException(ResponseCode.InvalidAiTaskId)\n    }\n    const volcengineAiLog = aiLog as VolcengineVideoAiLog\n\n    if (volcengineAiLog.status !== AiLogStatus.Generating) {\n      return\n    }\n\n    if (\n      status !== VolcTaskStatus.Succeeded\n      && status !== VolcTaskStatus.Failed\n      && status !== VolcTaskStatus.Expired\n    ) {\n      return\n    }\n\n    let aiLogStatus: AiLogStatus\n    switch (status) {\n      case VolcTaskStatus.Succeeded:","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-backend/apps/aitoearn-ai/src/core/ai/video/volcengine/volcengine.service.ts#L264-L300","documentation":"callback() resolves the internal AI log by the Volcengine task id. It throws AppException(ResponseCode.InvalidAiTaskId) when no AI log exists for that task id, or when the found log's channel is not Volcengine — meaning the callback does not correspond to a known Volcengine task in this system.","triggerScenarios":"Volcengine posts a completion callback with a task id that was never created here, was deleted, or belongs to another channel; environment mismatch (callback delivered to the wrong deployment); duplicated/replayed callback after log cleanup.","commonSituations":"Misconfigured callback URL pointing at another environment (staging vs prod); tasks created before a DB restore; third parties probing the callback endpoint with random ids.","solutions":["Verify the task id in the callback matches an existing ai_logs row with channel=Volcengine","Check the callback URL configuration points to the correct environment/database","Confirm the log wasn't deleted before the callback arrived; re-create the task if needed"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await volcengineService.callback(callbackData) } catch (e) { if (e instanceof AppException && e.code === ResponseCode.InvalidAiTaskId) { logger.warn({ taskId: callbackData.id }, 'unknown volcengine callback'); return; } throw e }","preventionTips":["Ensure the callback URL is registered per environment (cn vs ai)","Never delete ai_logs before terminal callbacks are consumed","Log and monitor unknown-callback events for misconfiguration"],"tags":["callback","task-not-found","volcengine","invalid-task-id"],"backgroundTag":"invalid-task-id","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}