| Previous | Next |
| ERROR_INVALID_STARTING_CODESEG | ERROR_INVALID_MODULETYPE |
ERROR_INVALID_STACKSEG
What ERROR_INVALID_STACKSEG means
ERROR_INVALID_STACKSEG is Win32 system error code associated with the documented message: “The operating system cannot run %1.” The significant condition is that the executable header designates an invalid segment for the initial stack. Preserve the symbolic name together with the numeric value because older diagnostic tools may display only one form.
This result is normally raised before application code reaches its regular entry point. The loader is validating image metadata, segment layout, imports, or the module class, so changing runtime permissions or retrying the same launch rarely addresses the root cause.
Likely causes
- the stack-segment index is outside the segment table
- the selected segment lacks attributes required for writable stack storage
- binary corruption or an incompatible linker changed the initial SS/SP metadata
Diagnostic procedure
- Inspect the legacy header’s stack segment and initial stack pointer
- Verify that the referenced segment exists and is writable
- Compare the failing image with the unmodified vendor executable
Code-specific investigation notes
The initial stack must reference writable storage with enough declared space for startup. A segment that exists but is code-only is still unsuitable.
Inspect both the stack-segment selector and initial stack offset. Corruption in the offset can present similarly to an invalid segment choice.
Because the process cannot establish a valid stack, crash dumps from inside the child may be unavailable; trace the parent launcher and loader instead.
Example incident
A deployment replaces one component but leaves an older companion module. At the next launch, the loader reads the image and returns it before normal application logging starts.
Difference from related errors
ERROR_INVALID_STARTING_CODESEG rejects the entry code segment; it rejects the initial stack definition.
Evidence to collect
- the raw decimal and hexadecimal value corresponding to it
- the exact API, command, or loader action that first produced the result
- paths after normalization and redirection, plus hashes and versions of involved binaries
- process architecture, session identity, compatibility mode, and relevant virtualization details
- a timestamp that can be correlated with application logs, Process Monitor traces, and Windows Event Log
References
Looking for a different code? Search another status or error code.