gravitational/teleport · error

no more IDs available

Error message

no more IDs available

What it means

When XCMisc is available, xvfb code installs an xgb SetIDRangeFunc; if the queried XID range is exhausted (StartId==0, Count==1), it returns this error so xgb knows no more X resource IDs can be allocated. It surfaces as an xgb allocation failure.

Source

Thrown at lib/srv/desktop/x11/xvfb.go:595

	_, err = damage.QueryVersion(conn, 1, 1).Reply()
	if err != nil {
		return nil, nil, trace.Wrap(err)
	}

	if err := randr.Init(conn); err != nil {
		return nil, nil, trace.Wrap(err)
	}
	_, err = randr.QueryVersion(conn, 5, 0).Reply()
	if err != nil {
		return nil, nil, trace.Wrap(err)
	}

	// Initialize the XCMisc extension for ID re-use - if successful then hook in to xgb.
	if err = xcmisc.Init(conn); err == nil {
		conn.SetIDRangeFunc(func(c *xgb.Conn) (uint32, uint32, error) {
			idRange, err := xcmisc.GetXIDRange(c).Reply()
			if err != nil || (idRange.StartId == 0 && idRange.Count == 1) { // that range is out of XID
				return 0, 1, errors.New("no more IDs available")
			}

			return idRange.StartId, idRange.Count, nil
		})
	}

	success = true
	return conn, setup, nil
}

// compositorPollFrames throttles compositor detection to roughly once per
// second at the capture frame rate while still capturing the root window.
const compositorPollFrames = 25

// refreshCaptureTarget detects whether a compositing window manager is active
// and switches frame capture to the overlay window.
// For non-compositing window managers (like Xfce) we keep capturing the root window.
func (x *Backend) refreshCaptureTarget() error {

View on GitHub (pinned to 1283425b60)

Solutions

  1. Restart the Xvfb/X server process to reset the XID allocator
  2. Fix ID leaks (destroy windows/pixmaps/contexts when sessions end)
  3. Ensure XCMisc extension init is working so ID ranges are managed correctly
  4. Monitor XID usage and recycle Xvfb instances before exhaustion

Example fix

// before
id, err := conn.NewID() // errors: no more IDs available
// after
if xidsExhausted { restartXvfb() }
id, err := conn.NewID()
Defensive patterns

Strategy: retry

Validate before calling

// before heavy X resource use
if range, err := xcmisc.GetXIDRange(conn).Reply(); err == nil && range.StartId == 0 && range.Count == 1 {
    restartXvfb()
}

Try / catch

id, err := conn.NewID()
if err != nil && strings.Contains(err.Error(), "no more IDs available") {
    // recycle Xvfb and reconnect
}

Prevention

When it happens

Trigger: The X server has run out of X resource IDs: xcmisc.GetXIDRange reports an empty range while the xgb connection requests a new ID.

Common situations: Long-lived Xvfb sessions leaking windows/pixmaps until XIDs are exhausted; a single Xvfb display serving many desktop sessions; X server not restarted for long periods.


AI-assisted analysis of gravitational/teleport@1283425b60 (2026-09-02). Data as JSON: /api/errors/b833e106029de47e. Report an issue: GitHub.