Site icon EfmSoft

What does HRESULT 0x00041306 (SCHED_S_TASK_TERMINATED) mean?

 
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, this result means that the last run of the task was terminated by the user. The high-level request can be considered complete after it only when its documented postcondition has been checked.

Where the status is encountered

Because it 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

Verify that the previous instance ended through an explicit stop or equivalent user action and its side effects are known. The verification prevents it from being promoted to broader success than the producing API promised.

The component may have changed durable or in-memory state before returning it; inspect that state first.

Evidence and telemetry

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. Protect user data in logs and keep only the identifiers required to reproduce component state.

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 it only when a documented input or state has changed. Retry policy must follow the owning state machine rather than a generic transient-error loop.

Difference from nearby results

SCHED_S_TASK_RUNNINGIt

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.

References


Looking for a different code? Search another status or error code.

Exit mobile version