{"record":{"id":"77157ae524356844","repo":"flipped-aurora/gin-vue-admin","slug":"s-77157a","errorCode":null,"errorMessage":"未知执行器类型: %s","messagePattern":"未知执行器类型: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/service/system/sys_timed_task_runner.go","lineNumber":59,"sourceCode":"\t\treturn s\n\t}\n\treturn s[:n] + \"...(截断)\"\n}\n\n// RunTask 统一执行入口(自动调度与手动触发共用):\n// panic 兜底、起止/耗时/状态/错误落 sys_timed_task_logs、失败经 SSE 告警。\n// 阻塞执行; 调度器回调与手动触发均应在独立 goroutine 中调用。\nfunc (s *TimedTaskService) RunTask(t system.SysTimedTask, trigger string) {\n\tstarted := time.Now()\n\tvar output string\n\tvar runErr error\n\tswitch t.ExecutorType {\n\tcase system.TimedTaskExecutorMethod:\n\t\toutput, runErr = s.runMethod(t)\n\tcase system.TimedTaskExecutorHTTP:\n\t\toutput, runErr = s.runHTTP(t)\n\tdefault:\n\t\trunErr = fmt.Errorf(\"未知执行器类型: %s\", t.ExecutorType)\n\t}\n\tfinished := time.Now()\n\n\tstatus := system.TimedTaskStatusSuccess\n\terrMsg := \"\"\n\tif runErr != nil {\n\t\tif errors.Is(runErr, errTaskTimeout) {\n\t\t\tstatus = system.TimedTaskStatusTimeout\n\t\t} else {\n\t\t\tstatus = system.TimedTaskStatusFail\n\t\t}\n\t\terrMsg = truncateText(runErr.Error(), maxLogTextLen)\n\t}\n\n\tlogRow := system.SysTimedTaskLog{\n\t\tTaskId:      t.ID,\n\t\tTaskName:    t.Name,\n\t\tTriggerType: trigger,","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/service/system/sys_timed_task_runner.go#L41-L77","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nrunErr = fmt.Errorf(\"未知执行器类型: %s\", t.ExecutorType)\n// after\n// fix the data:\nUPDATE sys_timed_task SET executor_type='method' WHERE executor_type='Method';","handlingStrategy":"validation","validationCode":"if executorType != system.TimedTaskExecutorMethod && executorType != system.TimedTaskExecutorHTTP {\n    return fmt.Errorf(\"unsupported executor type: %s\", executorType)\n}","typeGuard":"func isValidExecutorType(t string) bool {\n    return t == system.TimedTaskExecutorMethod || t == system.TimedTaskExecutorHTTP\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["timed-task","configuration","go"],"backgroundTag":"invalid-enum-value","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}