DEV Community

Cover image for Why Does DeepSeek Harness Exit with 0xC0000142?
啦啦啦种太阳
啦啦啦种太阳

Posted on Edited on Originally published at dsh-plugin.com

Why Does DeepSeek Harness Exit with 0xC0000142?

A Windows command that exits with 0xC0000142 under DeepSeek Harness may fail during restricted process initialization, before the command itself runs; compare modes and host evidence before selecting a workaround.

What does this exit code tell you?

The decimal exit code 3221225794 corresponds to 0xC0000142, reported as STATUS_DLL_INIT_FAILED. In discussion #8991, a user reports that even exit 0 fails under workspace-write, with no output or diagnostic. That is a useful small reproduction: a command intended to do nothing still fails. It is not, by itself, proof of which initialization step failed on your machine.

The sandbox reference describes a Windows ACL restricted-token backend. The policy concerns file effects; workspace-write permits writes inside the workspace and a backend-defined temporary area, while danger-full-access bypasses confinement. A sandbox runner failure and a command rejected by an otherwise functioning sandbox are different problems. The reference explicitly says an exit status alone does not prove a runner failure.

Windows sandbox diagnosis: compare modes, inspect host evidence, then choose a bounded workaround

Which root causes have users reported?

There is no single established cause for every occurrence. Discussion #10066 reports a desktop case in which the Electron GUI-subsystem executable was used to launch the runner. Its author reproduced failure when a restricted console child needed a new console, and success using a console-attached runner. The same report proposes a Node-based runner workaround; its paths and packaging details are specific to that installation.

Discussion #11223 reports a different controlled experiment: a capability SID in the restricting list allegedly had no read access entry on System32, causing initialization to fail even on an inherited-stdio path. The author presents this as a second trigger. These are user investigations, not an official universal diagnosis, and the latter discussion is unanswered. The observations do not make either explanation applicable to all machines.

The reports also differ in consequences. Discussion #8067 describes intermittent child-startup popups while the application continued; #11214 reports every sandboxed shell command failing and proposes a default-DACL change. A popup that accompanies otherwise successful work and a consistently failed tool call deserve separate investigation.

Evidence What it suggests What it does not establish
exit 0 fails without output Investigate startup and confinement The exact ACL or console cause
read-only works, workspace-write fails Compare mode-dependent setup That all restricted processes are safe or functional
Full access works Bypassing confinement changes the result That full access repairs the sandbox
A popup appears but work continues One child may have failed That every command failed

How can you narrow the failure safely?

  1. Record the Windows and DSH versions, desktop or other host, workspace location, effective permission mode, exact exit code, and whether output or a popup appeared. Remove secrets and private paths before sharing logs.
  2. Reproduce with a harmless command such as exit 0 through the affected shell tool. Compare it with the result outside the affected execution path; record which path produced each result. Avoid testing writes to sensitive locations.
  3. If your deployment exposes a read-only mode, compare the same harmless operation there. A difference is evidence for investigation, not proof of a specific cause. read-only cannot substitute for a workflow requiring writes.
  4. Compare the application host and console observations with the linked reports. Capture the runner diagnostic if one exists. A bare exit code may not be classified as infrastructure failure, as the reports describe.
  5. Check the current project discussion and release notes for your installed build before changing configuration. Record what changed and repeat the same minimal test after any update.

These steps isolate variables. They do not require a guessed ACL change, an undocumented command-line flag, or an assumption that the report's local patch is already shipped.

What workarounds are actually documented or reported?

For read-only investigation, use read-only only where your deployment offers it and the task needs no file writes. The sandbox reference defines its intended file-effect policy; Windows enforcement is reported as partial, so do not treat it as an absolute boundary. A result in this mode helps narrow the problem but may not unblock editing.

The author of #10066 reports routing the runner through a bundled console node.exe plus an unpacked runner shim. The example depends on actual installation paths and on how the desktop package exposes its files. The author of #11214 proposes a source change to the restricted token's default DACL; #11223 describes a separate access-check finding. None is a verified general-purpose fix in the cited discussion. Read the entire relevant thread and match its environment before attempting an advanced, reversible experiment.

The reference states that danger-full-access runs the original command without ctx.sandbox. It may change the symptom, and #10066 reports it working locally, but it removes confinement. Use it only when you accept that exposure for a trusted task and environment; restore the prior setting afterward. It is a diagnostic or exceptional workaround, not a repair to the restricted runner. See permission presets for the separate approval implications.

What should a useful comparison contain?

Keep the test as small as possible and change one condition at a time. For example, record the same harmless command in the affected tool, the effective mode and the resulting exit code. If an available read-only path succeeds, save that result alongside the failing workspace-write result. A comparison is more actionable when it includes both outcomes, rather than merely saying that the application “does not work.” Record whether the task was started from the desktop application or another host; a report about one host cannot establish the behavior of another.

A useful issue report also distinguishes an interactive Windows dialog from the shell tool's own result. Record whether the command completed, whether any output appeared and whether DSH itself continued to respond. Discussion #8067 describes a popup without stopping the application, whereas #8991 describes a command failure. Those observations can coexist across machines without implying that the same failure path caused both. Include only sanitized evidence; a workspace name or command output may reveal private project information.

Why not copy the proposed fixes immediately?

The #10066 runner workaround refers to a console executable and an unpacked shim. The discussion explains that packaging matters because ordinary Node cannot read the application's archive in the same way. An example containing placeholder paths is therefore not a ready-to-run recipe. Verify the installed layout and understand how to restore the old configuration before making a local experiment. If the evidence does not match that report, a different runner may not address the problem at all.

The later SID and default-DACL investigations offer other explanations and code proposals. They are valuable evidence to give maintainers, but changing a host's access rules or applying a third-party source patch affects a security boundary. The supplied references do not establish a released fix that works across all of these reports. Keep track of the version and exact change being tested, then run both a harmless command and the permitted task in a disposable or otherwise suitable workspace. A single success cannot establish that restrictions still work as intended.

If the only workable path is a full-access session, decide first whether the task truly needs that access. Inspect commands before running them, use a workspace without unnecessary sensitive material and return to the earlier settings afterward. The approval policy must be considered independently: full access does not itself tell you how an approval request is handled. A team maintaining a shared deployment should document that temporary exception so another user does not mistake it for the normal protected configuration.

A useful final check is to compare the original task with the minimal reproduction. If the minimal command now succeeds but the task still fails, examine the task's own error and requested file effects rather than continuing to attribute everything to startup. If the original symptom remains, preserve the before-and-after evidence and share the sanitized comparison in the relevant discussion. This makes it easier to distinguish a local workaround from a change that should be investigated upstream.

What are the limits and safety boundaries?

Do not broadly grant access to system directories or modify Windows security descriptors based only on this exit code. The discussions propose different mechanisms and do not establish the permissions needed on your host. Running the application elevated is also not established by these sources as a fix. A copy-pasted local path can refer to a different runtime or nonexistent shim.

The sandbox vocabulary covers file effects, not network isolation or process visibility. Windows ACL enforcement is documented as partial, including hard-link, unrestricted-read and AppContainer ACL boundaries. A successful test is evidence for that test only. If the task depends on a strong security boundary, stop and use an environment whose controls you can verify, rather than treating a successful command as a security audit.

Glossary

  • 0xC0000142: the Windows initialization failure status reported in the linked reproductions; its presence alone does not identify the cause.
  • Restricted token: the Windows execution mechanism used by the documented ACL backend to apply restrictions to a child process.
  • SID and ACE: a security identifier and an access-control entry; discussion #11223 investigates how a restricting SID interacts with an access check.
  • Runner: the component that wraps and starts a confined command; it can fail before the requested command has done useful work.
  • workspace-write: a file-effect mode permitting workspace and backend-defined temporary writes, subject to the backend's stated enforcement.

Originally published at https://dsh-plugin.com/blog/windows-sandbox-0xc0000142

Top comments (0)