flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

Unhandled Exception: HttpException: No valid statuscode. Statuscode was 404

Open anjrew opened this issue 7 years ago • 32 comments

E/flutter (18499): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: HttpException: No valid statuscode. Statuscode was 404 E/flutter (18499): #0 BaseCacheManager.getFile package:flutter_cache_manager/src/cache_manager.dart:120 E/flutter (18499): E/flutter (18499): #1 CachedNetworkImageState._animatedWidget package:cached_network_image/src/cached_image_widget.dart:261 E/flutter (18499): #2 CachedNetworkImageState.build package:cached_network_image/src/cached_image_widget.dart:194 E/flutter (18499): #3 StatefulElement.build package:flutter/…/widgets/framework.dart:3825 E/flutter (18499): #4 ComponentElement.performRebuild package:flutter/…/widgets/framework.dart:3736 E/flutter (18499): #5 Element.rebuild package:flutter/…/widgets/framework.dart:3559 E/flutter (18499): #6 ComponentElement._firstBuild package:flutter/…/widgets/framework.dart:3716 E/flutter (18499): #7 StatefulElement._firstBuild package:flutter/…/widgets/framework.dart:3864 E/flutter (18499): #8 ComponentElement.mount package:flutter/…/widgets/framework.dart:3711 E/flutter (18499): #9 Element.inflateWidget package:flutter/…/widgets/framework.dart:2956 E/flutter (18499): #10 Element.updateChild package:flutter/…/widgets/framework.dart:2759 E/flutter (18499): #11 SingleChildRenderObjectElement.mount package:flutter/…/widgets/framework.dart:4876 E/flutter (18499): #12 Element.inflateWidget package:flutter/…/widgets/framework.dart:2956 E/flutter (18499): #13 Element.updateChild package:flutter/…/widgets/framework.dart:2759 E/flutter (18499): #14 SingleChildRenderObjectElement.mount package:flutter/…/widgets/framework.dart:4876 E/flutter (18499): #15 Element.inflateWidget package:flutter/…/widgets/framework.dart:2956 E/flutter (18499): #16 Element.updateChild package:flutter/…/widgets/framework.dart:2759 E/flutter (18499): #17 SingleChildRenderObjectElement.mount package:flutter/…/widgets/framework.dart:4876 E/flutter (18499): #18 Element.inflateWidget package:flutter/…/widgets/framework.dart:2956 E/flutter (18499): #19 Element.updateChild package:flutter/…/widgets/framework.dart:2759 E/flutter (18499): #20 ComponentElement.performRebuild package:flutter/…/widgets/framework.dart:3747 E/flutter (18499): #21 Element.rebuild package:flutter/…/widgets/framework.dart:3559 E/flutter (18499): #22 ComponentElement._firstBuild package:flutter/…/widgets/framework.dart:3716 E/flutter (18499): #23 ComponentElement.mount package:flutter/…/widgets/framework.dart:3711 E/flutter (18499): #24 Element.inflateWidget package:flutter/…/widgets/framework.dart:2956 E/flutter (18499): #25 Element.updateChild package:flutter/…/widgets/framework.dart:2759 E/flutter (18499): #26 ComponentElement.performRebuild package:flutter/…/widgets/framework.dart:3747 E/flutter (18499): #27 Element.rebuild package:flutter/…/widgets/framework.dart:3559 E/flutter (18499): #28 ComponentElement._firstBuild package:flutter/…/widgets/framework.dart:3716 E/flutter (18499): #29 ComponentElement.mount package:flutter/…/widgets/framework.dart:3711 E/flutter (18499): #30 Element.inflateWidget package:flutter/…/widgets/framework.dart:2956 E/flutter (18499): #31 Element.updateChild package:flutter/…/widgets/framework.dart:2759 E/flutter (18499): #32 ComponentElement.performRebuild package:flutter/…/widgets/framework.dart:3747 E/flutter (18499): #33 Element.rebuild package:flutter/…/widgets/framework.dart:3559 E/flutter (18499): #34 ComponentElement._firstBuild package:flutter/…/widgets/framework.dart:3716 E/flutter (18499): #35 ComponentElement.mount package:flutter/…/widgets/framework.dart:3711 E/flutter (18499): #36 Element.inflateWidget package:flutter/…/widgets/framework.dart:2956 E/flutter (18499): #37 Element.updateChild package:flutter/…/widgets/framework.dart:2759 E/flutter (18499): #38 ComponentElement.performRebuild

anjrew avatar Mar 11 '19 08:03 anjrew

I have the same error. It only throws this error when I tried to load an image from a url whose response is 404. Is there some way to Catch this exception so that it will not throw an error on the console?

markgrancapal avatar Mar 21 '19 02:03 markgrancapal

In debug mode it seems to freeze the app.

kunit1 avatar Mar 27 '19 23:03 kunit1

The same problem. It's very strange to throw exceptions when image is not available without ability to catch it. Why just not add callback if any error?

VladimirCourse avatar Apr 04 '19 09:04 VladimirCourse

Emmm. I met the same error which response was 531

skysukai avatar Apr 12 '19 08:04 skysukai

I have the same problem when call to a url return 404.

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: HttpException: No valid statuscode. Statuscode was 404

shpy2001 avatar May 07 '19 01:05 shpy2001

I've set up with this

errorWidget: (context, url, error) => Icon(Icons.error),

but still, the app crashed when the image is 404.

so what's the point of errorWidget option?

fer-ri avatar May 27 '19 14:05 fer-ri

The error comes from visual code debugger (or somewhere around), if you use flutter run from console then all works as it should. It happened to me with my own code and I posted an issue. https://github.com/flutter/flutter/issues/33427

cosinus84 avatar May 30 '19 13:05 cosinus84

@cosinus84 I tried running it using flutter run in the console and it still threw this exception. In my code, it's a large list of items with an image for each item. The weird thing is that when they get loaded for the first time no exceptions are thrown, it normally displays the error widget as it should. However, if I start scrolling the list, the exceptions start getting thrown for images with 404 response. I'm not sure what's causing that, but I'll take a look as soon as I'm done with my finals.

bassel avatar May 30 '19 18:05 bassel

~~#144~~ #190 might fix this. @basselch, can you test it?

  cached_network_image:
    git:
      url: git://github.com/rmarau/flutter_cached_network_image.git
      ref: fix-getFile_multiplecalls

rmarau avatar May 31 '19 00:05 rmarau

@rmarau I tested it on my app and your fix works. No exceptions are thrown while scrolling

bassel avatar May 31 '19 20:05 bassel

I have the same problem. Any solution for that?

jonataslaw avatar Jun 15 '19 17:06 jonataslaw

Fixed in 1.1.0

renefloor avatar Jul 15 '19 06:07 renefloor

@renefloor I upgrade to 1.1.0, But got a new error.

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: type 'HttpException' is not a subtype of type 'FileInfo'    
#0      BaseCacheManager.getFile (package:flutter_cache_manager/src/cache_manager.dart:120:11)                     
<asynchronous suspension>                                                                                          
#1      CachedNetworkImageState._animatedWidget (package:cached_network_image/src/cached_image_widget.dart:270:12) 
#2      CachedNetworkImageState.build (package:cached_network_image/src/cached_image_widget.dart:196:12)           
#3      StatefulElement.build (package:flutter/src/widgets/framework.dart:4012:27)                                 
#4      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3924:15)                       
#5      Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)                                        
#6      StatefulElement.update (package:flutter/src/widgets/framework.dart:4085:5)                                 
#7      Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)                                   
#8      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)                       
#9      Element.rebuild (package:flutter/src/widgets/<…>              

lijy91 avatar Jul 15 '19 09:07 lijy91

I'm using version 1.1.0 and I still get the console error dump when I recieve a 403 status code when providing an errorWidget.

VyMajoris avatar Jul 17 '19 13:07 VyMajoris

@renefloor same error.

sujit-pasalkar avatar Jul 23 '19 12:07 sujit-pasalkar

We are also getting this error, but for 403

ghost avatar Jul 26 '19 10:07 ghost

I think we're running into https://github.com/flutter/flutter/issues/33427 which seems to be related to a VM problem.

larssn avatar Jul 26 '19 10:07 larssn

@renefloor

flutterbest avatar Jul 29 '19 01:07 flutterbest

Same question

yxwandroid avatar Jul 30 '19 09:07 yxwandroid

Same question

我还以为作者回复我了呢。。

flutterbest avatar Jul 30 '19 09:07 flutterbest