flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

CacheManager: Failed to download file from url

Open sandeep9607 opened this issue 5 years ago • 105 comments
trafficstars

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)

sandeep9607 avatar Feb 12 '20 14:02 sandeep9607

Flutter 1.12.13+hotfix.7

Any help would be appreciable. Thanks

sandeep9607 avatar Feb 12 '20 14:02 sandeep9607

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

samuelematias avatar Feb 12 '20 18:02 samuelematias

i have this same problam

taekungkub avatar Feb 19 '20 06:02 taekungkub

@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?

renefloor avatar Feb 21 '20 11:02 renefloor

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

dodancs avatar Mar 21 '20 08:03 dodancs

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.

dodancs avatar Mar 21 '20 10:03 dodancs

Does anyone solved this issue?

jawad12345A avatar Mar 31 '20 05:03 jawad12345A

@dodancs that is really strange, as far as I know an emulator works the same as a physical device.

renefloor avatar Mar 31 '20 07:03 renefloor

@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.

dodancs avatar Mar 31 '20 08:03 dodancs

@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

jawad12345A avatar Mar 31 '20 08:03 jawad12345A

same issue CacheManager: Failed to download file from ...

hasanzia1993 avatar Apr 03 '20 01:04 hasanzia1993

is there any solution for this or I also have to write "the SAME ISSUE"

DhavalRKansara avatar Apr 09 '20 12:04 DhavalRKansara

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.

hasanzia1993 avatar Apr 09 '20 14:04 hasanzia1993

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 avatar Apr 10 '20 09:04 renefloor

@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

DhavalRKansara avatar Apr 16 '20 13:04 DhavalRKansara

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?

renefloor avatar Apr 16 '20 14:04 renefloor

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.

DhavalRKansara avatar Apr 16 '20 14:04 DhavalRKansara

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 avatar Apr 17 '20 06:04 DhavalRKansara

@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 avatar Apr 17 '20 06:04 renefloor

@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.

DhavalRKansara avatar Apr 17 '20 06:04 DhavalRKansara

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.

DhavalRKansara avatar Apr 25 '20 13:04 DhavalRKansara

In my case, add

<uses-permission android:name="android.permission.INTERNET"/>

to android/app/src/main/AndroidManifest.xml worked.

ivenxu avatar May 03 '20 23:05 ivenxu

@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

hahazheng avatar May 12 '20 08:05 hahazheng

Operation timed out sounds like a bad internet connection.

renefloor avatar May 13 '20 06:05 renefloor

image

image

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 avatar May 18 '20 16:05 cargallo

@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.

renefloor avatar May 19 '20 08:05 renefloor

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.

cargallo avatar May 19 '20 17:05 cargallo

You can call it immature, but seeing the conversation on github about this I would not expect it to change soon if ever.

renefloor avatar May 20 '20 06:05 renefloor

I don't think this is really a bug in the library

renefloor avatar May 21 '20 14:05 renefloor

@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?

marcjoha avatar May 24 '20 16:05 marcjoha