flipped-aurora/gin-vue-admin · error
未知执行器类型: %s
Error message
未知执行器类型: %s
What it means
RunTask dispatches a timed task to an executor based on t.ExecutorType. Only 'method' (TimedTaskExecutorMethod) and 'http' (TimedTaskExecutorHTTP) are supported; any other stored value falls into the default branch and fails the run with this message.
Source
Thrown at server/service/system/sys_timed_task_runner.go:59
return s
}
return s[:n] + "...(截断)"
}
// RunTask 统一执行入口(自动调度与手动触发共用):
// panic 兜底、起止/耗时/状态/错误落 sys_timed_task_logs、失败经 SSE 告警。
// 阻塞执行; 调度器回调与手动触发均应在独立 goroutine 中调用。
func (s *TimedTaskService) RunTask(t system.SysTimedTask, trigger string) {
started := time.Now()
var output string
var runErr error
switch t.ExecutorType {
case system.TimedTaskExecutorMethod:
output, runErr = s.runMethod(t)
case system.TimedTaskExecutorHTTP:
output, runErr = s.runHTTP(t)
default:
runErr = fmt.Errorf("未知执行器类型: %s", t.ExecutorType)
}
finished := time.Now()
status := system.TimedTaskStatusSuccess
errMsg := ""
if runErr != nil {
if errors.Is(runErr, errTaskTimeout) {
status = system.TimedTaskStatusTimeout
} else {
status = system.TimedTaskStatusFail
}
errMsg = truncateText(runErr.Error(), maxLogTextLen)
}
logRow := system.SysTimedTaskLog{
TaskId: t.ID,
TaskName: t.Name,
TriggerType: trigger,View on GitHub (pinned to 3136500ef3)
Solutions
- Set t.ExecutorType to the constant system.TimedTaskExecutorMethod or system.TimedTaskExecutorHTTP for the task row
- Check where the task is created (admin UI / API payload) to ensure only the two supported values are submitted
- If you need a new executor kind, add a case to the switch in RunTask and implement the runner
Example fix
// before
runErr = fmt.Errorf("未知执行器类型: %s", t.ExecutorType)
// after
// fix the data:
UPDATE sys_timed_task SET executor_type='method' WHERE executor_type='Method'; Defensive patterns
Strategy: validation
Validate before calling
if executorType != system.TimedTaskExecutorMethod && executorType != system.TimedTaskExecutorHTTP {
return fmt.Errorf("unsupported executor type: %s", executorType)
} Type guard
func isValidExecutorType(t string) bool {
return t == system.TimedTaskExecutorMethod || t == system.TimedTaskExecutorHTTP
} Prevention
- Use a dropdown/enum in the admin UI instead of free-text for executor type
- Add a CHECK/enum constraint on sys_timed_task.executor_type
- Only reference the system.TimedTaskExecutor* constants in code
When it happens
Trigger: A SysTimedTask row was created (manually via DB, API, or a code-generator bug) with an ExecutorType not equal to 'method' or 'http', e.g. empty string, 'shell', 'Method' with different casing.
Common situations: Hand-inserting task rows into sys_timed_task; restoring data from an older schema where the enum values differed; frontend sending an unmapped executor type.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- 无可用初始化过程,请检查初始化是否已执行完成
- mssql config invalid
- mysql config invalid
- postgresql config invalid
- sqlite config invalid
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/77157ae524356844.
Report an issue: GitHub.