MathewSachin/Captura · error · Exception

There is already the maximum number of applications using th

Error message

There is already the maximum number of applications using the Desktop Duplication API running, please close one of the applications and try again.

What it means

Thrown by DuplCapture.Init (src/Captura.Windows/DesktopDuplication/DuplCapture.cs:66) when output.DuplicateOutput raises a SharpDXException whose Descriptor equals DXGI ResultCode.NotCurrentlyAvailable. That DXGI code means the Desktop Duplication API has already reached its maximum allowed concurrent duplications for the session/output.

Source

Thrown at src/Captura.Windows/DesktopDuplication/DuplCapture.cs:66

            }
        }

        public void Init()
        {
            lock (_syncLock)
            {
                _frameGrabber?.Dispose();
                _deskDupl?.Dispose();

                try
                {
                    _deskDupl = _output.DuplicateOutput(_device);

                    _frameGrabber = new FrameGrabber(_deskDupl);
                }
                catch (SharpDXException e) when (e.Descriptor == ResultCode.NotCurrentlyAvailable)
                {
                    throw new Exception(
                        "There is already the maximum number of applications using the Desktop Duplication API running, please close one of the applications and try again.",
                        e);
                }
                catch (SharpDXException e) when (e.Descriptor == ResultCode.Unsupported)
                {
                    throw new NotSupportedException(
                        "Desktop Duplication is not supported on this system.\nIf you have multiple graphic cards, try running Captura on integrated graphics.",
                        e);
                }
            }
        }

        public bool Get(Texture2D Texture, DxMousePointer DxMousePointer, Point TargetPosition = default)
        {
            lock (_syncLock)
            {
                // Disposed
                if (_device == null)

View on GitHub (pinned to 3fdf41529b)

Solutions

  1. Dispose all prior DuplCapture instances (free their OutputDuplication) before creating a new one.
  2. Close other applications using the Desktop Duplication API on this output, then retry Init.
  3. If the count recovers, allow Init to be retried after a short delay.
  4. Track active duplications per output and refuse over-allocation up front.

Example fix

// before
_deskDupl = _output.DuplicateOutput(_device);
// after - ensure previous duplication released first, then retry once
_deskDupl?.Dispose();
try { _deskDupl = _output.DuplicateOutput(_device); }
catch (SharpDXException e) when (e.Descriptor == ResultCode.NotCurrentlyAvailable)
    when (await RetryOnceAfter(500)) { _deskDupl = _output.DuplicateOutput(_device); }
Defensive patterns

Strategy: retry

Validate before calling

// ensure no leaked duplication before creating one
foreach (var c in ActiveCaptures) c.Dispose();
ActiveCaptures.Clear();
// only then call Init()

Try / catch

try { capture.Init(); }
catch (Exception e) when (e.InnerException is SharpDXException sx && sx.Descriptor == ResultCode.NotCurrentlyAvailable) { /* ask user to close other duplication apps, then retry once */ }

Prevention

When it happens

Trigger: Calling Output1.DuplicateOutput when the DXGI desktop duplication limit is already saturated. DXGI allows a fixed number of active OutputDuplication interfaces; once exceeded, duplication returns NotCurrentlyAvailable.

Common situations: Another screen recorder, streaming/overlay tool (OBS, Steam, Discord share), or a previous DuplCapture instance that was not Disposed is holding a duplication on the same output; Captura itself leaked a DuplCapture by forgetting to Dispose.

Related errors


AI-assisted analysis of MathewSachin/Captura@3fdf41529b (2026-08-13). Data as JSON: /api/errors/6b710032a3908123. Report an issue: GitHub.