| Previous | Next |
| ERROR_IO_PREEMPTED | E_FDPAIRING_NOCONNECTION |
JSCRIPT_E_CANTEXECUTE
Treat JScript function object no longer executable as a contract result, not as justification for resetting unrelated state. The script host retained or invoked a function after the engine had deleted the callable object or garbage collection had made its execution context unavailable. The failure is about object/engine lifetime, not JavaScript syntax.
First returning layer
The declared return type and source header determine the relevant status namespace.
A parse error happens while compiling script; this code occurs when attempting to execute a callable that no longer has a valid runtime lifetime. Keep the numeric value, declared return type, and first returning operation together with JSCRIPT_E_CANTEXECUTE; the same integer can belong to a different status namespace in another API.
Evidence map
| Capture | Diagnostic value |
|---|---|
| Script engine instance, function identity, host callback registration, document/context, and engine state. | Identifies the concrete object and operation associated with JScript function object no longer executable. |
| Event-handler or timer registration that retained the function beyond navigation, teardown, or engine close. | Separates argument or lifecycle state from a lower-layer provider failure. |
| COM reference/lifetime trace for host objects exposed to script. | Creates a stable before-and-after comparison. |
| Minimal reproduction showing the last valid invocation and the teardown event before failure. | Shows whether this condition is the first result or a translated summary. |
Preserve script engine instance, function identity, host callback registration, document/context, and engine state before reinstalling, rebooting, clearing state, or substituting another device or provider. A success observed only after such a change is useful comparison data, but it does not identify the original cause.
Change one condition at a time
- Invoke the callback synchronously before engine teardown. Keep unrelated inputs fixed so the changed result remains attributable to the tested variable.
- Remove the timer/event subscription during document unload and compare late calls. Record the first returned status and any state transition observed.
- Keep a deliberate host reference only until IActiveScript reaches the intended state. Treat a changed result as a new boundary rather than automatic resolution.
Decision points
| Observed comparison | Next conclusion to test |
|---|---|
| The first control changes the result | Concentrate on the variable isolated by this check: Invoke the callback synchronously before engine teardown. |
| The second comparison reproduces the same first status | Preserve lower-layer provider, driver, service, or runtime evidence before editing application data. The second controlled check was: Remove the timer/event subscription during document unload and compare late calls. |
| A different status appears after the bounded change | The operation moved to another boundary after the third controlled check. That check was: Keep a deliberate host reference only until IActiveScript reaches the intended state. Retain both results and interpret the replacement through its own API contract. |
Repair and regression test
Targeted correction. Unregister callbacks before closing the script engine, avoid retaining function objects across document generations, and serialize teardown with pending host invocations. Modify only the object, argument, policy, provider, or lifecycle state identified by the collected evidence.
Acceptance criterion. No callback runs after engine close, navigation/reload cycles release old function objects, and the current document callbacks remain executable. Re-run the original operation that produced this condition under its original identity and supported configuration, then keep one negative control that still produces the expected neighboring outcome.
Technical references
References for JSCRIPT_E_CANTEXECUTE on the deployed platform version.
- Microsoft Open Specifications: HRESULT values — defines the status namespace used.
- Microsoft: HRESULT facility extraction — documents the API or lifecycle boundary behind this condition.
- Microsoft: Active Script architecture — provides ABI, implementation, or protocol context.
- Microsoft: IActiveScript:Close — supports the portability and verification limits.
Looking for a different code? Search another status or error code.