Skip to content

CachedNetworkImage logs errors / crashes on Windows when image URL returns 404 #1023

Description

@duc0103

Using CachedNetworkImage on Windows, if the image URL is invalid (returns 404 from the server), the app repeatedly logs:

[ERROR:flutter/shell/platform/windows/task_runner_window.cc(61)] Failed to post message to main thread

and sometimes the app crashes.

This happens even when using errorWidget or a custom CacheManager.

Steps to Reproduce:

Use CachedNetworkImage with an invalid URL, for example:

CachedNetworkImage(
imageUrl: "https://brickfever.nl/wp-content/uploads/2022/11/LOGO-2022-Owen-EXPORT.png",
errorWidget: (context, url, error) => Icon(Icons.error),
)

Run the app on Windows.

Observe repeated error logs and/or crash.

Expected behavior:

Image should fallback to errorWidget.

No repeated log spam or crash.

Cache should not store invalid 404 images.

Environment:

Flutter version: 3.35.3

flutter_cache_manager ^3.4.0

cached_network_image version: cached_network_image: ^3.4.1

Platform: Windows 10/11

Additional context:

Issue only occurs on Windows; Android/iOS works fine.

The URL being invalid (404) triggers the log/crash immediately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions