wasabeef/android-gpuimage · error · RuntimeException

eglConfig not initialized

Error message

eglConfig not initialized

What it means

createSurface() found eglConfig null: EGL initialized and a display exists, but config selection never happened (or was explicitly nulled when the weak-referenced view died in start()). Surface creation cannot proceed without a chosen EGLConfig.

Solutions

  1. Fix the underlying config-selection failure that left eglConfig null
  2. Ensure the GLTextureView stays attached/alive while its render thread initializes EGL
  3. Recreate the EglHelper (call start() again) instead of proceeding with null config
  4. Don't requestRender or touch the surface until onSurfaceCreated/onSurfaceAvailable
Defensive patterns

Strategy: validation

Validate before calling

if (glTextureViewWeakRef.get() == null) { /* view detached: abort thread, don't proceed with null config */ }

Try / catch

// catch (RuntimeException e) { stop GL thread; let re-attached view start a new EglHelper }

Prevention

When it happens

Trigger: createSurface() runs with eglConfig == null — chooseConfig() threw earlier, or start() detected glTextureViewWeakRef.get() == null and set eglConfig = null before finishing setup.

Common situations: Earlier 'No configs match configSpec' / 'No config chosen' failures partially handled, GLTextureView detached before EglHelper finished starting (weak ref cleared), component recycled mid-initialization.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of wasabeef/android-gpuimage@ceea576ec9 (2026-09-11). Data as JSON: /api/errors/b731e62c0a871c40. Report an issue: GitHub.

Appendix: source

Thrown at library/src/main/java/jp/co/cyberagent/android/gpuimage/GLTextureView.java:968

         * already exists, destroy it before creating the new surface.
         *
         * @return true if the surface was created successfully.
         */
        public boolean createSurface() {
            if (LOG_EGL) {
                Log.w("EglHelper", "createSurface()  tid=" + Thread.currentThread().getId());
            }
            /*
             * Check preconditions.
             */
            if (egl == null) {
                throw new RuntimeException("egl not initialized");
            }
            if (eglDisplay == null) {
                throw new RuntimeException("eglDisplay not initialized");
            }
            if (eglConfig == null) {
                throw new RuntimeException("eglConfig not initialized");
            }

            /*
             *  The window size has changed, so we need to create a new
             *  surface.
             */
            destroySurfaceImp();

            /*
             * Create an EGL surface we can render into.
             */
            GLTextureView view = glTextureViewWeakRef.get();
            if (view != null) {
                eglSurface = view.eglWindowSurfaceFactory.createWindowSurface(egl, eglDisplay, eglConfig,
                        view.getSurfaceTexture());
            } else {
                eglSurface = null;
            }

View on GitHub (pinned to ceea576ec9)