Skip to content

[Web][CanvasKit] WebGL: INVALID_VALUE: texImage2D: no image error on Flutter 3.27+ / 3.47.2 when rendering Slivers with RepaintBoundary #192347

Closed

Description

@aliesdd1993-sketch

Steps to reproduce

  1. Run a Flutter Web application using the CanvasKit renderer (flutter run -d chrome --web-renderer canvaskit).
  2. Create a CustomScrollView containing a SliverGrid with SliverChildBuilderDelegate.
  3. Set addRepaintBoundaries: false on the delegate and manually wrap each item widget with a RepaintBoundary.
  4. Trigger scrolling or loading states in the grid.
  5. Check the browser developer console.

Expected results

CanvasKit should render the grid smoothly without WebGL memory/texture exceptions, or handle unrendered picture frames gracefully without throwing INVALID_VALUE: texImage2D: no image.

Actual results

The browser console continuously throws a WebGL exception and fails to render texture layers:

WebGL: INVALID_VALUE: texImage2D: no image
makeTexture @ canvaskit.js:22
methodCaller<() => unsigned int> @ canvaskit.js:150
p @ canvaskit.js:150
$func8394 @ canvaskit.wasm:0x40e954
Canvas._drawPicture @ canvaskit.js:109
a.Canvas.drawPicture @ canvaskit.js:51
drawPicture @ canvas.dart:246
(anonymous) @ surface.dart:307

### Code sample

---

### **5. Code sample **
import 'dart:async';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

void main() => runApp(const ReproApp());

class ReproApp extends StatelessWidget {
  const ReproApp({super.key});
  @override
  Widget build(BuildContext context) =>
      const MaterialApp(home: ReproGridPage());
}

class ReproGridPage extends StatefulWidget {
  const ReproGridPage({super.key});
  @override
  State<ReproGridPage> createState() => _ReproGridPageState();
}

class _ReproGridPageState extends State<ReproGridPage> {
  final ScrollController _scrollController = ScrollController();
  Timer? _scrollTimer;
  Timer? _stateTimer;
  bool _scrollingDown = true;
  int _tick = 0;

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) {
      _scrollTimer = Timer.periodic(const Duration(milliseconds: 900), (_) {
        if (!_scrollController.hasClients) return;
        final max = _scrollController.position.maxScrollExtent;
        _scrollController.animateTo(
          _scrollingDown ? max : 0.0,
          duration: const Duration(milliseconds: 800),
          curve: Curves.easeInOut,
        );
        _scrollingDown = !_scrollingDown;
      });
      _stateTimer = Timer.periodic(const Duration(milliseconds: 1500), (_) {
        setState(() => _tick++);
      });
    });
  }

  @override
  void dispose() {
    _scrollTimer?.cancel();
    _stateTimer?.cancel();
    _scrollController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Repro — tick: $_tick')),
      body: CustomScrollView(
        controller: _scrollController,
        slivers: [
          SliverPadding(
            padding: const EdgeInsets.all(4),
            sliver: SliverGrid(
              gridDelegate:
              const SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 2,
                crossAxisSpacing: 4,
                mainAxisSpacing: 4,
                childAspectRatio: 1,
              ),
              delegate: SliverChildBuilderDelegate(
                addRepaintBoundaries: false, // manual wrap below
                    (context, index) => RepaintBoundary(
                  key: ValueKey('item_$index'),
                  child: _ReproTile(index: index, tick: _tick),
                ),
                childCount: 60,
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class _ReproTile extends StatelessWidget {
  final int index;
  final int tick;
  const _ReproTile({required this.index, required this.tick});

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.grey[300],
      child: CachedNetworkImage(
        imageUrl: 'https://picsum.photos/seed/$index/400/400',
        fit: BoxFit.cover,
        placeholder: (_, __) => const Center(
          child: CircularProgressIndicator(strokeWidth: 2),
        ),
        errorWidget: (_, __, ___) =>
        const Center(child: Icon(Icons.broken_image)),
      ),
    );
  }
}


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

WebGL: INVALID_VALUE: texImage2D: no image
makeTexture @ canvaskit.js:22
methodCaller<() => unsigned int> @ canvaskit.js:150
p @ canvaskit.js:150
$func8394 @ canvaskit.wasm:0x40e954
$func10248 @ canvaskit.wasm:0x487f6b
Canvas._drawPicture @ canvaskit.js:109
a.Canvas.drawPicture @ canvaskit.js:51
drawPicture @ canvas.dart:246


### Flutter Doctor output

flutter doctor -v
[√] Flutter (Channel stable, 3.47.2, on Microsoft Windows [Version 10.0.26200.9168], locale en-US) [265ms]
• Flutter version 3.47.2 on channel stable at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d3b14c8769 (11 days ago), 2026-08-26 16:07:51 -0700
• Engine revision a804b26164
• Dart version 3.13.2
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[√] Windows Version (11 Pro 64-bit, 25H2, 2009) [958ms]

[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [5.6s]
• Android SDK at C:\Users\User\AppData\Local\Android\sdk
• Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
• Platform android-37.0, build-tools 36.0.0
! Multiple adb binaries found. This can cause conflicts and device detection issues:
- C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe
- C:\Windows\System32\adb
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 25.0.2+-15348964-b329.117)
• All Android licenses accepted.

[√] Chrome - develop for the web [22ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps [21ms]
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components

[√] Connected device (3 available) [190ms]
• Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26200.9168]
• Chrome (web)      • chrome  • web-javascript • Google Chrome 135.0.7049.84
• Edge (web)        • edge    • web-javascript • Microsoft Edge 152.0.4191.62

[√] Network resources [2.0s]
• All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. suryaKommana2662 commented on Sep 7, 2026

    @suryaKommana2662
    Contributor

    @aliesdd1993-sketch Reproduced locally on macOS using the sample provided in the issue with flutter run -d chrome. The Chrome DevTools console shows 12WebGL: INVALID_VALUE: texImage2D: no image. The --web-renderer canvaskit option from the reported reproduction is not available in the Flutter version I tested. Routing this to team-web for further investigation.

    Flutter Doctor -v

    [✓] Flutter (Channel stable, 3.47.2, on macOS 26.4 25E246 darwin-arm64, locale en-IN) [174ms]
        • Flutter version 3.47.2 on channel stable at /Users/suryakommana/develop/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision d3b14c8769 (11 days ago), 2026-08-26 16:07:51 -0700
        • Engine revision a804b26164
        • Dart version 3.13.2
        • DevTools version 2.60.0
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
          enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [747ms]
        • Android SDK at /Users/suryakommana/Library/Android/sdk
        • Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
        • Platform android-37.0, build-tools 36.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 25.0.2+-15348964-b329.117)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 26.6) [421ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 17F113
        • CocoaPods version 1.17.0
    
    [✓] Chrome - develop for the web [3ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (4 available) [5.6s]
        • sdk gphone16k arm64 (mobile) • emulator-5554                        • android-arm64  • Android 17 (API 37) (emulator)
        • iPhone 17 pro (mobile)       • DB7548B3-163D-4C89-A357-B948B8CE1F16 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-26-5 (simulator)
        • macOS (desktop)              • macos                                • darwin-arm64   • macOS 26.4 25E246 darwin-arm64
        • Chrome (web)                 • chrome                               • web-javascript • Google Chrome 152.0.7977.82
    
    [✓] Network resources [901ms]
        • All expected network resources are available.
    
    • No issues found!
  2. added
    c: renderingUI glitches reported at the engine/skia or impeller rendering level
    team-webOwned by Web platform team
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-webWeb applications specifically
    e: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Web
    and removed
    in triagePresently being triaged by the triage team
    on Sep 7, 2026
  3. harryterkelsen commented on Sep 9, 2026

    @harryterkelsen
    Contributor

    This seems like a duplicate of #191800.

    I'll investigate this shortly

  4. eduardohr-muniz commented on Sep 24, 2026

    @eduardohr-muniz

    Requesting a cherry-pick of #192516 (PictureImageTracker) into flutter-3.47-candidate.0.

    We hit this in production on 3.47.1, not in a synthetic repro: two customer-facing Flutter web apps (a store front and a merchant console) started rendering network images as solid black rectangles, intermittently, with WebGL: INVALID_VALUE: texImage2D: no image from makeTexture under Canvas._drawPicture — the same stack as this issue. It appeared on our first production build on the 3.47 line; the previous build on 3.44.5 was clean.

    The reason I think this is worth a cherry-pick rather than waiting for the next minor is that the two obvious escape routes are blocked:

    1. Staying on 3.47.x has no real workaround. The trigger is ImageCache eviction disposing the image mid-rasterization, so raising imageCache.maximumSize / maximumSizeBytes only makes eviction rarer — any catalog larger than the new ceiling brings the black frames back. That is what we shipped, and it is a delay, not a fix.

    2. Downgrading reintroduces a worse regression. The first stable containing fix(web): Fix LateInitializationError in CkSurface and SkwasmSurface #185116 ("[web] Fix LateInitializationError in CkSurface and SkwasmSurface") is 3.47.0. On 3.44.x, losing the WebGL context makes onContextLost throw, recovery aborts, and the entire canvas stays black until a page reload — considerably worse than a few black images. So web apps that need fix(web): Fix LateInitializationError in CkSurface and SkwasmSurface #185116 are pinned to exactly the versions that carry this bug.

    I also checked 3.47.5 (released after #192516 landed on master): its cherry-picks are the iOS 27 debug crash, the Widget Previewer scroll restoration crash, and the DDS startup FormatException — this fix is not among them, and I could not find any open PR targeting flutter-3.47-candidate.0 that carries it.

    Happy to test a candidate build against our production workload if that helps.

  5. github-actions commented on Oct 8, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

assigned for triageissue is assigned to a domain expert for further triagec: renderingUI glitches reported at the engine/skia or impeller rendering levele: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyteam-webOwned by Web platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions