yikart/AiToEarn · error · AppHttpException
ErrHttpBack.user_task_no_had
ErrHttpBack.user_task_no_had
Error message
user_task_no_had
What it means
AppHttpException with ErrHttpBack.user_task_no_had (errCode 60010, message '用户任务不存在'), a 404-style business error. Thrown by the submitTask controller when the userTask id in the path does not exist OR exists but belongs to a different user than the token. It doubles as an ownership check, so it can also mean 'not yours'.
Source
Thrown at project/aitoearn-electron/server/src/modules/task/task.controller.ts:109
const res = await this.userTaskService.userApplyTask(token.id, task, body);
if (!!body.taskMaterialId)
this.taskService.upTaskMaterialUsedCount(body.taskMaterialId);
return res;
}
@ApiOperation({ summary: '提交任务 id是用户任务ID' })
@ApiResult({ type: Boolean })
@Post('submit/:id')
async submitTask(
@GetToken() token: TokenInfo,
@Param('id') id: string,
@Body() data: SubmitTaskDto,
) {
const userTask = await this.userTaskService.getUserTaskInfoById(id);
if (!userTask || userTask.userId.toString() !== token.id)
throw new AppHttpException(ErrHttpBack.user_task_no_had);
const res = await this.userTaskService.submitTask(userTask, data);
if (res.status === UserTaskStatus.PENDING) {
this.bullTaskAuditQueue.add(
'start',
{
userTaskId: id,
},
{
attempts: 5, // 这个作业特定的重试次数
backoff: {
type: 'fixed', // 固定间隔重试
delay: 1000 * 30, // 每次重试间隔5秒
},
},
);
}View on GitHub (pinned to d3aa8bea5b)
Solutions
- Use the userTask id (from the apply response / user task list), not the task id
- Ensure the Authorization token belongs to the same user as the userTask record
- Re-fetch the user's task list to confirm the record still exists before submitting
- Check the id string is not truncated or trimmed incorrectly on the client
Example fix
// before await api.submitTask(task.id, data) // wrong id: task id, not userTask id // after const userTask = await api.getUserTaskList().then(l => l.find(t => t.taskId === task.id)) await api.submitTask(userTask.id, data)
Defensive patterns
Strategy: try-catch
Validate before calling
const userTasks = await api.getUserTaskList(token.id)
const ut = userTasks.find(t => t.id === userTaskId && t.userId === token.id)
if (!ut) throw new Error('userTask does not exist or is not owned by the current user') Type guard
function isOwnUserTask(ut: UserTask | null, userId: string): ut is UserTask {
return !!ut && ut.userId.toString() === userId
} Try / catch
try {
await api.submitTask(userTaskId, data)
} catch (e) {
if (e?.errCode === '60010') {
// wrong id or wrong token user: re-fetch user task list with the current token
} else throw e
} Prevention
- Distinguish task id vs userTask id in client models
- Never reuse tokens across accounts in multi-account flows
- Refresh the user task list after apply to get the authoritative userTask id
When it happens
Trigger: PUT/POST submit to /task/user/:id/submit (task.controller.ts:109) where getUserTaskInfoById(id) returns null, or userTask.userId !== token.id — e.g. submitting a wrong id, a task of another account, or with an expired/wrong-user token.
Common situations: Client submits with an old userTask id after re-applying; multi-account login mixup sends another user's token; id confusion between the task id and the userTask id (they are different documents).
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- InvalidAiTaskId
- AiLogNotFound
- ResponseCode.ChannelAccountAlreadyConnectedToAnotherUser
- ResponseCode.ChannelAccountNotAuthorized
- ChannelAccountAlreadyConnectedToAnotherUser
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/aa7e9d0d7b528b9c.
Report an issue: GitHub.