cached_network_image: ^2.0.0
I/flutter (23961): CacheManager: Failed to download file from http://host/images/a.png with error:
I/flutter (23961): SocketException: Failed host lookup: 'host' (OS Error: No address associated with hostname, errno = 7)
Flutter 1.12.13+hotfix.7
Any help would be appreciable.
Thanks
I'm have the same issue:
flutter: CacheManager: Failed to download file from https://static-images.api.com.br/image/upload/f_auto,t_thumbnail/icones/pgto/******** with error:
HttpException: No valid statuscode. Statuscode was 404
Flutter Version:
Flutter 1.12.13+hotfix.7 โข channel stable โข https://github.com/flutter/flutter.git
Framework โข revision 9f5ff2306b (2 weeks ago) โข 2020-01-26 22:38:26 -0800
Engine โข revision a67792536c
Tools โข Dart 2.7.0
Plugin Version:
cached_network_image: ^2.0.0
i have this same problam
@sandeep9607 @samuelematias or @taekungkub can any of you give me a valid URL that does load in the browser (and doesn't give a 404), but does not load in the CachedNetworkImage?
I have some similar issue:
CacheManager: Failed to download file from URL with error:
type '(HttpException) => Null' is not a subtype of type '(dynamic) => dynamic'
First time using the package, it took like 5 reloads of my app to successfully display the image...
I have some similar issue:
CacheManager: Failed to download file from URL with error: type '(HttpException) => Null' is not a subtype of type '(dynamic) => dynamic'First time using the package, it took like 5 reloads of my app to successfully display the image...
- Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale sk-SK)
- cached_network_image: ^2.0.0
This only happened when using an Emulator to run my app. When I switched to my physical device, the errors did not appear.... this is strange. I also tried disabling Proxy settings on the android emulator, but with no change.
Does anyone solved this issue?
@dodancs that is really strange, as far as I know an emulator works the same as a physical device.
@renefloor Doesn't seem like it. I'm not sure what could be causing this. But I spent a lot of hours trying to fix my "broken code" to only realize it was because of the emulator. I also never seen anything like this before.
@renefloor Doesn't seem like it. I'm not sure what could be causing this. But I spent a lot of hours trying to fix my "broken code" to only realize it was because of the emulator. I also never seen anything like this before.
It is also happening on physical phone too
same issue CacheManager: Failed to download file from ...
is there any solution for this or I also have to write "the SAME ISSUE"
same issue CacheManager: Failed to download file from ...
It actually is working fine for me now, my URL was not returning any data first. Could be something else for other but for me it's working perfectly fine now.
is there any solution for this or I also have to write "the SAME ISSUE"
@DhavalRKansara you could help in looking for a solution. I don't know why files sometimes fail to download, as I still don't have a reproducible example of an url that should work but doesn't
@renefloor Actually You guys can add one null and empty check before network request for the image and if image URL is null then simply show the placeholder image means no need to do network request for null image URL.
Because in my case I have some image URL as null or empty and then I am getting the error:
flutter: CacheManager: Failed to download file from null with error:
Invalid argument(s): No host specified in URI null
Hmm, not sure if I agree with that. Why the placeholder and not the error widget? I would expect an error when the image is null. What is your usecase that null is a valid image?
Hmm, not sure if I agree with that. Why the placeholder and not the error widget? I would expect an error when the image is null. What is your use case that null is a valid image?
Yeah totally agree we can show error image In case of null or empty image URL.
This is really Strange, Now I am also facing the same issues while downloading the images.
In my case, I have to pass httpHeader with AuthToken to download the image using this library. Also, I am getting the error every time sometimes it successfully download the image and sometimes it gives the below error. It's really strange.
flutter: CacheManager: Failed to download file from https://*****?imageName=jpg file.jpg&path=Patient_Documents\ with error:
HttpException: Invalid statusCode: 500, uri = https://*****?imageName=jpg%20file.jpg&path=Patient_Documents%5C
@renefloor Have you faced the error in any example?
@DhavalRKansara a statusCode 500 normally is something going wrong on the server. I guess you have to discuss this with the backend developer. I don't know if you have content with him/her?
@DhavalRKansara a statusCode 500 normally is something going wrong on the server. I guess you have to discuss this with the backend developer. I don't know if you have content with him/her?
@renefloor Yes I have discussed with my backend developer and also for the same URL I have tried to get an image through the postman and I successfully get the image in postman. That's why I am saying that not every time I got failed to download network image it's 50-50 scenario and still I'm looking into it with different testing scenarios.
cached_network_image: ^2.0.0
I/flutter (23961): CacheManager: Failed to download file from http://host/images/a.png with error:
I/flutter (23961): SocketException: Failed host lookup: 'host' (OS Error: No address associated with hostname, errno = 7)
Please check the image file url carefully... Because I don't found any image for the given url.
In my case, add
<uses-permission android:name="android.permission.INTERNET"/>
to android/app/src/main/AndroidManifest.xml worked.
@renefloor @DhavalRKansara
flutter: CacheManager: Failed to download file from http://mt3.google.com/vt/lyrs=m&x=32752&y=21795&z=16 with error:
SocketException: OS Error: Operation timed out, errno = 60, address = mt3.google.com, port = 52998
Example url:
http://mt3.google.com/vt/lyrs=m&x=32752&y=21795&z=16
Operation timed out sounds like a bad internet connection.


Same Issue here! I want to test whats would happen if the url is wrong. In the case of firebase storage it returns 403. But the problem is thtat I don't know why the debugger is stopping there since I think it should be a Controlled Exception..
@cargallo That's an issue of the Dart VM, it doesn't always know if an exception is uncaught or not. See https://stackoverflow.com/questions/56802675/dart-flutter-debugger-stops-on-caught-exceptions
It should not break your app.
Tnx @renefloor I didn't knew that. Also I'm facing issues with the use of try catch and Futures and Error handling in Flutter, plus your comment I asume that Dart is some kind of immature in this context.
You can call it immature, but seeing the conversation on github about this I would not expect it to change soon if ever.
I don't think this is really a bug in the library
@renefloor I don't fully understand this issue, so this might be unfeasible, but any chance this library could benefit from the advice in https://github.com/flutter/flutter/issues/33427#issuecomment-523615622?
I was having the same problem while running in real mobile device so the problem was that I was not connecting with the internet so that is all I fix
I ran into this issue once I tried loading the 2.3.0-rc version to test. Once I did, the app hangs in emulator any time a I hit a 404 on an image. I wasn't getting any errors in vscode debug. But then I enabled All Exceptions and saw it break in flutter_cache_manager 1.4.1 in web_helper.dart line 84. It shows "Invalid statusCode: 404".
Its not a connection issue, or at least that doesn't make sense when other images load fine from same server and when its always the same missing files. Its only when I hit an actual 404, the file isn't on the server. I just downgraded back to 2.2.0+1 and still get crashes now. Not sure what to do to get the app running correctly again, and I don't know how to error trap in the widget code.
Edit: App runs fine now, just needed to uncheck "Uncaught Exceptions". But I do see lots of HttpExceptions with that error in DevTools. Also, not relevant to this issue, but I had to delete all the pubspec cache directories and the pubspec.lock file to get rid of the 2.3.0-rc version, which kept coming back, confusing me even further.
did anyone found the way out for this problem??
CacheManager: Failed to download file from https://kc-vendor-qa.s3.ap-south-1.amazonaws.com/user/42/profile/mh6SAE4fBjU6lNeM5hV9vw4pjZB81QyU1xJjZlVy.jpeg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAZQBUL2OKXSTRB5O6%2F20200729%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20200729T074210Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3300&X-Amz-Signature=e3709a8df5b74a6fbe61f1510957c05015d3b79f4246fd90c0c5c738c8523340 with error:
I/flutter (15558): Connection closed before full header was received
I/flutter (15558): inside errorConnection closed before full header was received
Here's for better understanding. This image URL on browser opens the image, however, this exact URL opens image almost 9/10 times with CachedNetworkImage
Same issue, the image url return 404
Same issue here. Connection closed before full header was received.
Same issue. When I request many images such as 30 images within api, connection closed and a little images returned error.
@gustavo-perini
@Jayant-BL
@whatamelon
Did you figure it out ?
Same error.
@gustavo-perini
@Jayant-BL
@whatamelon
Did you figure it out ?
Still searching for a solution.
Not yet.
On Fri, Sep 4, 2020 at 8:30 AM Jayant Choudhary notifications@github.com
wrote:
@gustavo-perini https://github.com/gustavo-perini
@Jayant-BL https://github.com/Jayant-BL
@whatamelon https://github.com/whatamelon
Did you figure it out ?Still searching for a solution.
โ
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Baseflow/flutter_cached_network_image/issues/336#issuecomment-687087763,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AOCMPJVSLTTLH57ZUUEBFITSEDFUFANCNFSM4KT2WEOA
.
solved it guys!
your imageUrl is getting null..
just check if it is not null then return CachedNetImage otherwise return a container using ternary operator ::
child: photoUrl!=null ? CachedNetworkImage(
placeholder: (context,photo)=>Container(
child: CircularProgressIndicator(
strokeWidth: 2.0,
valueColor: AlwaysStoppedAnimation
),
width: 200.0, height: 200.0,
padding: EdgeInsets.all(20.0),
),
imageUrl: photoUrl,
width: 200.0, height: 200.0,
fit: BoxFit.cover,
) : Container(),
@renefloor Actually You guys can add one null and empty check before network request for the image and if image URL is null then simply show the placeholder image means no need to do network request for null image URL.
Because in my case I have some image URL as null or empty and then I am getting the error:
flutter: CacheManager: Failed to download file from null with error: Invalid argument(s): No host specified in URI nullsolved it guys!
your imageUrl is getting null..
just check if it is not null then return CachedNetImage otherwise return a container using ternary operator ::
child: photoUrl!=null ? CachedNetworkImage(
placeholder: (context,photo)=>Container(
child: CircularProgressIndicator(
strokeWidth: 2.0,
valueColor: AlwaysStoppedAnimation(Colors.lightBlueAccent),
),
width: 200.0, height: 200.0,
padding: EdgeInsets.all(20.0),
),
imageUrl: photoUrl,
width: 200.0, height: 200.0,
fit: BoxFit.cover,
) : Container(),
I just solved with image url https -> http.
I think flutter's decoding image codec with https logic is too slow or not perfect when get many images.
So, problem can produce like me.
Well, I think this is not a solution for every piece of problem with this issue.
Hope it will be a solution for getting problem like me.
any solution?
any solution?
same here.
reload another image solved for me
Flutter 1.12.13+hotfix.7
Any help would be appreciable.
Thanks
In my case, I updated cached_network_image to version ^ 2.4.1.
Same issue here !
CacheManager: Failed to download file from with error: Invalid argument(s): No host specified in URI
There is no problem on UI. Images loaded but I tought an error.
For others coming here, you may be mistaking the IDE debugger stopping on the exception as the CachedNetworkImage not working by showing the errorWidget. That's what I thought. However, you can press the continue button or turn off the "Uncaught exceptions" breakpoint and the errorWidget will still show. See issue #467 and my Stack Overflow Q&A:
@suragch thanks for your answer, I included in a newly made FAQ: https://github.com/Baseflow/flutter_cached_network_image/commit/d4b09daf3442902afa49976c19ba9adf51f292e8
Hi ! I have a carousel that had this error, and when one of the image was failing, all the others failed. So I solved it enforcing each CachedNetworkImage() with UniqueKey(), so flutter has each widget uniquely identified. I hope it helps!
I used to have the same issue!
If you have a break on exceptions enabled the debugger stops, but that's because the dart VM doesn't always know whether an exception is caught or not. If you continue this still shouldn't freeze your app.



crashalitics also catch this issue. @renefloor there is something really weired
No host specified means the url didn't start with http(s)://. Do you have any idea what the url could have been?
cached_network_image: ^2.0.0
I/flutter (23961): CacheManager: Failed to download file from http://host/images/a.png with error:
I/flutter (23961): SocketException: Failed host lookup: 'host' (OS Error: No address associated with hostname, errno = 7)
In your original post you did have 'http', but you had an invalid hostname 'host'.
It's for example.but it happends for all Images @renefloor
2021-05-09 14:09:46.585635+0530 Runner[5713:2950075] flutter: CacheManager: Failed to download file from with error:
Invalid argument(s): No host specified in URI
2021-05-09 14:09:46.600427+0530 Runner[5713:2950075] flutter: โโโก EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2021-05-09 14:09:46.600546+0530 Runner[5713:2950075] flutter: The following ArgumentError was thrown resolving an image codec:
2021-05-09 14:09:46.600590+0530 Runner[5713:2950075] flutter: Invalid argument(s): No host specified in URI
2021-05-09 14:09:46.600622+0530 Runner[5713:2950075] flutter:
2021-05-09 14:09:46.600660+0530 Runner[5713:2950075] flutter: When the exception was thrown, this was the stack:
2021-05-09 14:09:46.600700+0530 Runner[5713:2950075] flutter: #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2407:9)
2021-05-09 14:09:46.600732+0530 Runner[5713:2950075] flutter: #1 _HttpClient.openUrl (dart:_http/http_impl.dart:2323:7)
2021-05-09 14:09:46.600761+0530 Runner[5713:2950075] flutter: #2 IOClient.send (package:http/src/io_client.dart:31:37)
2021-05-09 14:09:46.600975+0530 Runner[5713:2950075] flutter: #3 HttpFileService.get (package:flutter_cache_manager/src/web/file_service.dart:33:44)
2021-05-09 14:09:46.601076+0530 Runner[5713:2950075] flutter: #4 WebHelper._download (package:flutter_cache_manager/src/web/web_helper.dart:106:24)
2021-05-09 14:09:46.601673+0530 Runner[5713:2950075] flutter: #5 WebHelper._updateFile (package:flutter_cache_manager/src/web/web_helper.dart:91:28)
2021-05-09 14:09:46.601903+0530 Runner[5713:2950075] flutter:
2021-05-09 14:09:46.602097+0530 Runner[5713:2950075] flutter: #6 WebHelper._downloadOrAddToQueue (package:flutter_cache_manager/src/web/web_helper.dart:65:14)
2021-05-09 14:09:46.602234+0530 Runner[5713:2950075] flutter: #7 WebHelper.downloadFile (package:flutter_cache_manager/src/web/web_helper.dart:44:17)
2021-05-09 14:09:46.602398+0530 Runner[5713:2950075] flutter: #8 CacheManager._pushFileToStream (package:flutter_cache_manager/src/cache_manager.dart:144:27)
2021-05-09 14:09:46.602555+0530 Runner[5713:2950075] flutter:
2021-05-09 14:09:46.602707+0530 Runner[5713:2950075] flutter: #9 CacheManager.getFileStream (package:flutter_cache_manager/src/cache_manager.dart:122:5)
2021-05-09 14:09:46.602878+0530 Runner[5713:2950075] flutter: #10 ImageCacheManager.getImageFile (package:flutter_cache_manager/src/cache_managers/image_cache_manager.dart:27:14)
2021-05-09 14:09:46.603055+0530 Runner[5713:2950075] flutter:
2021-05-09 14:09:46.603269+0530 Runner[5713:2950075] flutter: #11 CachedNetworkImageProvider._loadAsync (package:cached_network_image/src/image_provider/_image_provider_io.dart:99:18)
2021-05-09 14:09:46.603508+0530 Runner[5713:2950075] flutter:
2021-05-09 14:09:46.603690+0530 Runner[5713:2950075] flutter: #12 CachedNetworkImageProvider.load (package:cached_network_image/src/image_provider/_image_provider_io.dart:71:14)
2021-05-09 14:09:46.603855+0530 Runner[5713:2950075] flutter: #13 ImageProvider.resolveStreamForKey.
2021-05-09 14:09:46.604054+0530 Runner[5713:2950075] flutter: #14 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:355:22)
2021-05-09 14:09:46.604229+0530 Runner[5713:2950075] flutter: #15 ImageProvider.resolveStreamForKey (package:flutter/src/painting/image_provider.dart:502:83)
2021-05-09 14:09:46.604456+0530 Runner[5713:2950075] flutter: #16 ScrollAwareImageProvider.resolveStreamForKey (package:flutter/src/widgets/scroll_aware_image_provider.dart:108:19)
2021-05-09 14:09:46.604626+0530 Runner[5713:2950075] flutter: #17 ImageProvider.resolve.
2021-05-09 14:09:46.604758+0530 Runner[5713:2950075] flutter: #18 ImageProvider._createErrorHandlerAndKey.
2021-05-09 14:09:46.604951+0530 Runner[5713:2950075] flutter: #19 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:41:35)
2021-05-09 14:09:46.605136+0530 Runner[5713:2950075] flutter: #20 ImageProvider._createErrorHandlerAndKey.
2021-05-09 14:09:46.605371+0530 Runner[5713:2950075] flutter: #24 ImageProvider._createErrorHandlerAndKey (package:flutter/src/painting/image_provider.dart:452:16)
2021-05-09 14:09:46.605559+0530 Runner[5713:2950075] flutter: #25 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:330:5)
2021-05-09 14:09:46.605751+0530 Runner[5713:2950075] flutter: #26 _ImageState._resolveImage (package:flutter/src/widgets/image.dart:1156:16)
2021-05-09 14:09:46.606014+0530 Runner[5713:2950075] flutter: #27 _ImageState.didChangeDependencies (package:flutter/src/widgets/image.dart:1109:5)
2021-05-09 14:09:46.606543+0530 Runner[5713:2950075] flutter: #28 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4797:14)
2021-05-09 14:09:46.606582+0530 Runner[5713:2950075] flutter: #29 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
2021-05-09 14:09:46.606614+0530 Runner[5713:2950075] flutter: #30 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2730:33)
2021-05-09 14:09:46.606647+0530 Runner[5713:2950075] flutter: #31 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:913:20)
2021-05-09 14:09:46.606709+0530 Runner[5713:2950075] flutter: #32 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:302:5)
2021-05-09 14:09:46.606824+0530 Runner[5713:2950075] flutter: #33 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
2021-05-09 14:09:46.606942+0530 Runner[5713:2950075] flutter: #34 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1055:9)
2021-05-09 14:09:46.607115+0530 Runner[5713:2950075] flutter: #35 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:971:5)
2021-05-09 14:09:46.607307+0530 Runner[5713:2950075] flutter: #39 _invoke (dart:ui/hooks.dart:251:10)
2021-05-09 14:09:46.607642+0530 Runner[5713:2950075] flutter: #40 _drawFrame (dart:ui/hooks.dart:209:3)
2021-05-09 14:09:46.607856+0530 Runner[5713:2950075] flutter: (elided 6 frames from dart:async)
2021-05-09 14:09:46.608033+0530 Runner[5713:2950075] flutter:
2021-05-09 14:09:46.608175+0530 Runner[5713:2950075] flutter: Image provider: CachedNetworkImageProvider("", scale: 1.0)
2021-05-09 14:09:46.608291+0530 Runner[5713:2950075] flutter: Image key: CachedNetworkImageProvider("", scale: 1.0):
2021-05-09 14:09:46.608428+0530 Runner[5713:2950075] flutter: CachedNetworkImageProvider("", scale: 1.0)
Valid url @renefloor https://hd.tudocdn.net/874944?w=646&h=284
I/flutter (17973):
I/flutter (17973): Image provider: CachedNetworkImageProvider("", scale: 1.0)
I/flutter (17973): Image key: CachedNetworkImageProvider("", scale: 1.0):
I/flutter (17973): CachedNetworkImageProvider("", scale: 1.0)
I/flutter (17973): โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโ Exception caught by image resource service โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The following ArgumentError was thrown resolving an image codec:
Invalid argument(s): No host specified in URI
When the exception was thrown, this was the stack
package:http/src/io_client.dart:31
package:flutter_cache_manager/โฆ/web/file_service.dart:33
package:flutter_cache_manager/โฆ/web/web_helper.dart:106
...
Image provider: CachedNetworkImageProvider("", scale: 1.0)
Image key: CachedNetworkImageProvider("", scale: 1.0): CachedNetworkImageProvider("", scale: 1.0)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
URl not loading is: https://firebasestorage.googleapis.com/v0/b/mesocialmobile.appspot.com/o/user%2FN2q4tIWzRqa460xsHcbusPMtq4x2%2FprofileImage%2F952651d0-a026-11eb-bee4-438e4c3ebe8a.jpg?alt=media&token=681da556-540c-40ae-98a1-6a968ab24fdf
2021-05-10 11:09:52.935491+0530 Runner[6333:3213281] flutter: Image provider: CachedNetworkImageProvider("", scale: 1.0)
2021-05-10 11:09:52.935514+0530 Runner[6333:3213281] flutter: Image key: CachedNetworkImageProvider("", scale: 1.0):
2021-05-10 11:09:52.935535+0530 Runner[6333:3213281] flutter: CachedNetworkImageProvider("", scale: 1.0)
2021-05-10 11:09:52.935559+0530 Runner[6333:3213281] flutter: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2021-05-10 11:09:53.657355+0530 Runner[6333:3213281] flutter: CacheManager: Failed to download file from with error:
Invalid argument(s): No host specified in URI
@renefloor it work first time perfectly, but second time it suck, it crash iOS version, while android is able to survive.
In my case, I am passing the null value to imgurl that's why the problem occurs.
If you have a problem, just print the URL if it is null or not & then provide a proxy image URL to check it's working to not.
Hi. I don't want to turn off uncaught exceptions in my IDE. It helps me catch runtime errors. This widget constantly breaking on uncaught exceptions is problematic for development.
How can we show a placeholder image, if application is failed or not able to fetch image content from server? Kindly suggest. Thanks.
How can we show a placeholder image, if application is failed or not able to fetch image content from server? Kindly suggest. Thanks.
By setting the placeholder as errorWidget:
CachedNetworkImage(
imageUrl: "http://via.placeholder.com/200x150",
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
colorFilter:
ColorFilter.mode(Colors.red, BlendMode.colorBurn)),
),
),
placeholder: (context, url) => CircularProgressIndicator(),
errorWidget: (context, url, error) => CircularProgressIndicator(),
),
You can also only set the placeholder and not the errorWidget, in that case the placeholder will be used as errorWidget.
Most helpful comment
I have some similar issue:
First time using the package, it took like 5 reloads of my app to successfully display the image...