| Previous | Next |
| DISP_E_DIVBYZERO | TYPE_E_BUFFERTOOSMALL |
DISP_E_BUFFERTOOSMALL
Automation output buffer is too small
DISP_E_BUFFERTOOSMALL is HRESULT 2147614739 (0x80020013) from winerror.h. The documented description is “Buffer too small.” The value must be interpreted at Automation helper or dispatch operation writing textual, binary, or metadata output into caller-provided storage.
The caller-provided capacity cannot contain the complete result. When this result crosses a language or process boundary, preserve its original numeric form before projections replace it with a broad exception class.
Where the result appears
- This result is returned while Automation binds or executes Automation helper or dispatch operation writing textual, binary, or metadata output into caller-provided storage.
- Retain the member name and DISPID, invocation flags, LCID, cArgs, cNamedArgs, and the exact VARIANTARG sequence in reverse Automation order.
- The output contract includes puArgErr, EXCEPINFO, result VARIANT, by-reference values, and SAFEARRAY lock or ownership state; inspect them before cleanup.
Triage of this result starts by locating the exact owner of the failing state, including object identity, apartment, package, and deployment generation.
Typical causes and interpretation
Common cause categories are: bytes are confused with characters; terminator space is omitted; data grew between size query and fill; fixed legacy buffers are used. Do not treat the cause list as a checklist of simultaneous failures; use traces and postconditions to select the matching branch.
Key distinction: the caller-provided capacity cannot contain the complete result.
Evidence to preserve
- Record it with the object CLSID or ProgID, interface identity, member DISPID, dispatch flags, and type-library version.
- Capture supplied and required lengths; units; terminator requirement; partial output; retry contract; character width.
- Log VARIANT type tags, dimensions, bounds, lengths, and null/empty distinctions, but redact actual confidential argument values.
- Preserve the caller language/runtime, generated interop version, LCID, and whether the call crossed a process boundary when it occurs.
- After it, call VariantClear, SysFreeString, SafeArrayDestroy, or release interfaces only for values whose ownership was transferred by the documented contract.
When recording it, retain structural metadata and redact content-bearing arguments, authentication material, and personal data.
Correct handling and recovery
The appropriate recovery is to obtain the required size where supported, allocate with overflow checks, retry once against a stable snapshot, and treat partial data according to contract. A retry policy needs a bounded attempt count, a state refresh step, and a rule for reconciling work that may already have completed.
Cleanup following it must be generation-aware: do not destroy shared state or outputs owned by an earlier successful operation.
Practical scenario
A wrapper allocates characters using a byte count from a Unicode API; converting units and reserving the terminator fixes the call.
Coverage should include the exact failure, a corrected success case, and the closest related HRESULT so classification remains stable.
Difference from related HRESULTs
TYPE_E_BUFFERTOOSMALL occurs in type-information APIs; it is associated with Automation dispatch or conversion output.
Tests and telemetry should retain the producing component and operation so future wrappers do not flatten this result into an ambiguous generic exception.
References
Looking for a different code? Search another status or error code.