| Previous | Next |
| SCHED_S_TASK_NOT_SCHEDULED | SCHED_S_TASK_NO_VALID_TRIGGERS |
SCHED_S_TASK_TERMINATED
Last scheduled task run was terminated by the user
SCHED_S_TASK_TERMINATED is HRESULT 267014 (0x00041306) from winerror.h. AllStat describes it as “The last run of the task was terminated by the user.” The severity bit indicates a nonfailure result, but the value carries a specific condition that must not be collapsed into plain S_OK.
In the Task Scheduler state query, SCHED_S_TASK_TERMINATED means that the last run of the task was terminated by the user. The high-level request can be considered complete after SCHED_S_TASK_TERMINATED only when its documented postcondition has been checked.
Where the status is encountered
SCHED_S_TASK_TERMINATEDcan be returned during Task Scheduler status monitoring; log the exact method and object state instead of interpreting the constant outside that contract.SCHED_S_TASK_TERMINATEDcan be returned during deployment or maintenance task validation; log the exact method and object state instead of interpreting the constant outside that contract.SCHED_S_TASK_TERMINATEDcan be returned during automation that reads task state before starting work; log the exact method and object state instead of interpreting the constant outside that contract.
Because SCHED_S_TASK_TERMINATED is informational, a language binding may expose it as success and hide the symbolic distinction. Keep the original HRESULT available until the code-specific branch has run.
What must be true before accepting it
For SCHED_S_TASK_TERMINATED, verify that the previous instance ended through an explicit stop or equivalent user action and its side effects are known. The verification prevents SCHED_S_TASK_TERMINATED from being promoted to broader success than the producing API promised.
The component may have changed durable or in-memory state before returning SCHED_S_TASK_TERMINATED; inspect that state first.
Evidence and telemetry
- For
SCHED_S_TASK_TERMINATED, preserve last run time and result. - For
SCHED_S_TASK_TERMINATED, preserve operator or process that requested stop. - For
SCHED_S_TASK_TERMINATED, preserve running-instance ID. - For
SCHED_S_TASK_TERMINATED, preserve action exit and cleanup state. - For
SCHED_S_TASK_TERMINATED, preserve restart and multiple-instance policies.
Also record sched_s_task_terminated_operation, sched_s_task_terminated_state_before, sched_s_task_terminated_state_after, UTC time, process and thread identifiers, component version, and a correlation ID. For SCHED_S_TASK_TERMINATED, protect user data in logs and keep only the identifiers required to reproduce component state.
Diagnostic sequence
- Capture the raw value
0x00041306before wrappers, signed-decimal formatting, exceptions, or generic success handling replaceSCHED_S_TASK_TERMINATED. - Identify the operation that returned
SCHED_S_TASK_TERMINATED, including interface or callback, component build, thread, process, and the state-machine phase. - For
SCHED_S_TASK_TERMINATED, prove the decisive condition: the previous instance ended through an explicit stop or equivalent user action and its side effects are known. - Inspect every output, count, status array, buffer, callback, task state, media timestamp, transaction vote, or security token that remains part of the
SCHED_S_TASK_TERMINATEDcontract. - Compare state immediately before and after
SCHED_S_TASK_TERMINATED; success severity does not guarantee that optional work or the caller’s intended high-level action completed. - Reproduce
SCHED_S_TASK_TERMINATEDwith the smallest input that retains the same condition, then alter only the recorded cause before repeating the operation.
Correct handling and recovery
Inspect the action process tree, termination event, and partial outputs. Resume only if the action is restart-safe; otherwise clean up or roll back before scheduling another run.
Retry SCHED_S_TASK_TERMINATED only when a documented input or state has changed. For SCHED_S_TASK_TERMINATED, retry policy must follow the owning state machine rather than a generic transient-error loop.
Difference from nearby results
SCHED_S_TASK_RUNNINGSCHED_S_TASK_TERMINATED
For SCHED_S_TASK_TERMINATED, the nearby-status comparison controls whether outputs are usable and whether more work is expected.
Practical scenario
A data export task was stopped from Task Scheduler while writing a package. Operations delete the incomplete package, retain the stop event and operator identity, then rerun from a clean checkpoint.
A regression test should reproduce SCHED_S_TASK_TERMINATED, assert the relevant outputs and state, then change only the decisive condition and verify the expected neighboring result or ordinary completion.
Developer and administrator guidance
Code should branch on SCHED_S_TASK_TERMINATED before a generic SUCCEEDED(hr) path whenever outputs, continuation, cancellation, or recovery differ. Telemetry should retain SCHED_S_TASK_TERMINATED, 0x00041306, the producing method, and a correlation ID.
For SCHED_S_TASK_TERMINATED, document ownership of retry, cancellation, cleanup, and user messaging. Operational remediation of SCHED_S_TASK_TERMINATED belongs to the producing provider, service, pipeline, or security package.
References
- Microsoft: Task Scheduler error and success constants — official Microsoft material used to interpret
SCHED_S_TASK_TERMINATED. - Microsoft: Task Scheduler reference — official Microsoft material used to interpret
SCHED_S_TASK_TERMINATED. - Microsoft: HRESULT values — official Microsoft material used to interpret
SCHED_S_TASK_TERMINATED.
Looking for a different code? Search another status or error code.