What does Windows error code 561 (ERROR_INVALID_LDT_SIZE) mean?

 
Could be also:
ConstantTypeOS
HTTP_STATUS_UNAUTHORIZEDHTTP CodeAny
Previous Next
ERROR_NO_GUID_TRANSLATION ERROR_INVALID_LDT_OFFSET

ERROR_INVALID_LDT_SIZE

An attempt was made to grow an LDT by setting its size, or the size was not an even number of selectors.

ERROR_INVALID_LDT_SIZE is Windows system result 561 (0x00000231). Microsoft defines it as “An attempt was made to grow an LDT by setting its size, or the size was not an even number of selectors.” The value should be captured immediately at the producing boundary because later diagnostics, cleanup, or retry code can overwrite a thread-local last-error value or collapse a richer native status.

How to classify this result

ERROR_INVALID_LDT_SIZE represents an x86 Local Descriptor Table size validation failure. The correct interpretation depends on the low-level x86 or WOW compatibility operation that supplied the LDT byte count and selector range.

The most important boundary for ERROR_INVALID_LDT_SIZE is whether the operation reached a documented final state.

Where it can appear

  • ERROR_INVALID_LDT_SIZE can appear in legacy x86 execution support.
  • ERROR_INVALID_LDT_SIZE can appear in a debugger or compatibility component inspecting descriptor-table entries.
  • ERROR_INVALID_LDT_SIZE can appear in low-level code translating a native LDT status into Win32.

When ERROR_INVALID_LDT_SIZE is found only in a log, preserve the logger, event provider, process, thread, and translation path.

Typical causes

  • For ERROR_INVALID_LDT_SIZE, the requested size is not a multiple of the selector-entry size.
  • For ERROR_INVALID_LDT_SIZE, the operation attempts to grow the table through a size-setting path that does not permit growth.
  • For ERROR_INVALID_LDT_SIZE, a byte count was confused with an entry count.
  • For ERROR_INVALID_LDT_SIZE, 32-bit layout assumptions were used on an unsupported architecture.
  • For ERROR_INVALID_LDT_SIZE, integer truncation produced a misaligned final size.

These causes are starting points for ERROR_INVALID_LDT_SIZE, not substitutes for evidence.

Diagnostic sequence

  1. Confirm that the failing path is valid only on x86 or the documented WOW compatibility surface.
  2. Capture the requested byte size and calculated selector count.
  3. Verify alignment against the descriptor entry size used by that API.
  4. Check whether allocation or growth must occur through a different operation.
  5. Compare structure packing and field widths with the installed SDK headers.
  6. Reproduce with the smallest descriptor set rather than an entire process image.

After the first pass, reproduce ERROR_INVALID_LDT_SIZE with the smallest input and only one intentional fault.

Evidence to preserve

  • Record processor architecture and WOW state for ERROR_INVALID_LDT_SIZE.
  • Record requested LDT size in bytes and entries for ERROR_INVALID_LDT_SIZE.
  • Record selector-entry structure size for ERROR_INVALID_LDT_SIZE.
  • Record calling system service or compatibility component for ERROR_INVALID_LDT_SIZE.
  • Record native status before Win32 mapping for ERROR_INVALID_LDT_SIZE.

For ERROR_INVALID_LDT_SIZE, also retain decimal 561, hexadecimal 0x00000231, UTC time, machine build, component version, and a correlation identifier.

Recovery and retry

The recovery objective for ERROR_INVALID_LDT_SIZE is to Correct the count and alignment, or remove the unsupported attempt to grow the LDT through the size-setting request.

Do not retry the same size. Retry only after recalculating the request from validated entry boundaries and confirming the operation is supported on the current architecture.

Difference from related results

ERROR_INVALID_LDT_OFFSET concerns where the update starts; ERROR_INVALID_LDT_DESCRIPTOR concerns descriptor contents. ERROR_INVALID_LDT_SIZE is about the total requested extent.

Keep the original constant in telemetry rather than replacing ERROR_INVALID_LDT_SIZE with a nearby result that seems more familiar.

Practical validation scenario

A 32-bit compatibility tool multiplies a selector count by the wrong packed structure size and submits an odd extent. Logging the count, byte size, and sizeof result makes the alignment error visible before any descriptor is changed.

A useful test report for ERROR_INVALID_LDT_SIZE includes the failing call, exact input, state before the call, raw output, expected state, and observed state after recovery.

Telemetry and support fields

  • Record invalid_ldt_size_operation for the producing API, callback, wait, driver, packaging phase, or service transition.
  • Record invalid_ldt_size_target for the stable session, selector, device, pin, content, resource, service, or validation identity.
  • Record invalid_ldt_size_state_before and invalid_ldt_size_requested_state using explicit units and enum names.
  • Record invalid_ldt_size_raw_status, the original result domain, and any later HRESULT or Win32 conversion.
  • Record invalid_ldt_size_attempt, elapsed time, process and thread IDs, server or device instance, and correlation ID.

Alerting for ERROR_INVALID_LDT_SIZE should reflect the classification above.

Developer and administrator guidance

Keep LDT manipulation isolated behind architecture checks. Modern applications should not introduce new dependencies on x86 descriptor tables; compatibility tooling should validate every count before entering the system service.

Developers should preserve ERROR_INVALID_LDT_SIZE at module boundaries and document whether ownership of buffers, handles, mutexes, callbacks, or transition contexts changes on return.

References


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