fyne-io/fyne · critical

eglGetConfigAttrib failed\n

Error message

eglGetConfigAttrib failed\n

What it means

In x11.c, right after a config is chosen, the driver asks for its EGL_NATIVE_VISUAL_ID to find the matching X visual. Failure here means the EGL implementation could not report a native visual for a config it just returned: a driver bug or a config that has no X visual at all (surfaceless/pbuffer-only leaked through the filter). The process prints 'eglGetConfigAttrib failed' and exits(1).

Source

Thrown at internal/driver/mobile/app/x11.c:38

		EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
		EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
		EGL_BLUE_SIZE, 8,
		EGL_GREEN_SIZE, 8,
		EGL_RED_SIZE, 8,
		EGL_ALPHA_SIZE, 8,
		EGL_DEPTH_SIZE, 16,
		EGL_CONFIG_CAVEAT, EGL_NONE,
		EGL_NONE
	};
	EGLConfig config;
	EGLint num_configs;
	if (!eglChooseConfig(e_dpy, attribs, &config, 1, &num_configs)) {
		fprintf(stderr, "eglChooseConfig failed\n");
		exit(1);
	}
	EGLint vid;
	if (!eglGetConfigAttrib(e_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
		fprintf(stderr, "eglGetConfigAttrib failed\n");
		exit(1);
	}

	XVisualInfo visTemplate;
	visTemplate.visualid = vid;
	int num_visuals;
	XVisualInfo *visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
	if (!visInfo) {
		fprintf(stderr, "XGetVisualInfo failed\n");
		exit(1);
	}

	Window root = RootWindow(x_dpy, DefaultScreen(x_dpy));
	XSetWindowAttributes attr;

	attr.colormap = XCreateColormap(x_dpy, root, visInfo->visual, AllocNone);
	if (!attr.colormap) {
		fprintf(stderr, "XCreateColormap failed\n");

View on GitHub (pinned to 8860ee95c3)

Solutions

  1. Update the GPU driver / Mesa to a current version and retry
  2. Force a known-good software path: LIBGL_ALWAYS_SOFTWARE=1 ./yourapp
  3. Inspect what EGL is active: eglinfo -B and glxinfo | grep -i vendor
  4. If persistent, patch x11.c to fall back to the screen's default visual when EGL_NATIVE_VISUAL_ID fails instead of exiting

Example fix

// before (x11.c): exit when the attrib query fails
if (!eglGetConfigAttrib(e_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
	fprintf(stderr, "eglGetConfigAttrib failed\n");
	exit(1);
}

// after: use the default visual as a fallback
if (!eglGetConfigAttrib(e_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
	vid = XVisualIDFromVisual(DefaultVisual(x_dpy, DefaultScreen(x_dpy)));
}
Defensive patterns

Strategy: validation

Validate before calling

func eglSanity() error {
	out, err := exec.Command("eglinfo").CombinedOutput()
	if err != nil {
		return fmt.Errorf("eglinfo failed (broken EGL install): %w\n%s", err, out)
	}
	return nil
}

Prevention

When it happens

Trigger: eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID) returning false on the selected config; typically vendor EGL stacks (proprietary NVIDIA) or very old Mesa where the chosen config has no X11 visual.

Common situations: Machines with mixed vendor EGL (NVIDIA ICD plus Mesa DRI); outdated Mesa; EGL implementations primarily targeting surfaceless platforms being handed an X display.

Related errors


AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15). Data as JSON: /api/errors/2fb8ad6a6dfd91cc. Report an issue: GitHub.