miguelpruivo / flutter_file_picker

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
MIT License
1.32k stars 655 forks source link

Unhandled Exception: FileSystemException: Cannot retrieve length of file, path = '/private/var/mobile/Containers/Data/Application/31609356-B2FF-4E41-8576-D0D46E7D0DF3/tmp/com.loancloud.fund1-Inbox/form_template.pdf' (OS Error: No such file or directory, errno = 2) #867

Closed Nolan1357 closed 2 years ago

Nolan1357 commented 2 years ago

Before creating an issue, make sure that you are on the latest file_picker version and that there aren't already any similar opened inssues. Also, check if it isn't described on the Wiki, specially on Troubleshooting page.

Also, sometimes a simple flutter clean and flutter build again with latest file_picker version, may end up by fixing cached issues, so I encourage you to first do so.

Describe the bug A clear and concise description of what the bug is. If the issue happens to be on Android, please make sure that it also happens with a different device/simulator and/or version.

Platform

Platform OS version What version did it happen?

How are you picking?

Please, post the snippet here

Details to reproduce the issue Provide all the details to reproduce the issue.

Error Log Please, post the full console log of your issue, if applicable.

Screenshots and/or video If applicable, add screenshots or video to help explain your problem.

Flutter Version details Please, post the output of your flutter doctor -v, preferably, while running the issued device/simulator.

Additional context Add any other context about the problem here.

Nolan1357 commented 2 years ago

There is a problem with the IOS phone, and the Android does not appear Occasional bug

Nolan1357 commented 2 years ago

Hope to find out and solve it in time, thank you sir

miguelpruivo commented 2 years ago

I’m sorry but I didn’t get your issue. You seem to be trying to open a file that doesn’t exist on iOS.

Nolan1357 commented 2 years ago

![Uploading image.png…]()

Nolan1357 commented 2 years ago

sorry English not good but you can

261

FileSystemException: Cannot retrieve length of file,(OS Error: No such file or directory, errno = 2) #261

miguelpruivo commented 2 years ago

Give this a try.

Nolan1357 commented 2 years ago

I tryed thank you very match

miguelpruivo commented 2 years ago

Did it work?

Nolan1357 commented 2 years ago

No sir

miguelpruivo commented 2 years ago

What if you try with a different file/device?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 14 days with no activity.

swapnilsinha17 commented 2 years ago

Hii @miguelpruivo @Nolan1357

i also getting this issue.

Please help.

Nolan1357 commented 2 years ago

Hii @miguelpruivo @Nolan1357

i also getting this issue.

Please help.

Sorry ,

Nolan1357 commented 2 years ago

Hii @miguelpruivo @Nolan1357

i also getting this issue.

Please help. 这几天 我从 Dio File_path flutter_file_picker 找出问题 如果我发现了哪里出现的BUG 我会第一时间 发布

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 14 days with no activity.

swapnilsinha17 commented 2 years ago

@miguelpruivo Please look into this issue.

It's urgent.

miguelpruivo commented 2 years ago

I’m not sure how to replicate this and also seems that to be an edge case.

Nolan1357 commented 2 years ago

复制一下 就没问题了 static Future copyFile(String result) async{ File file = File(result); final documentPath = (await getApplicationDocumentsDirectory()).path; file = await file.copy('$documentPath/${path.basename(file.path)}'); print(file.path); print(file.existsSync()); return file; }

Nolan1357 commented 2 years ago

https://github.com/miguelpruivo/flutter_file_picker/issues/867#issuecomment-983269041

swapnilsinha17 commented 2 years ago

@miguelpruivo getting this issue only on iphone devices occasionally.Android working perfect.

swapnilsinha17 commented 2 years ago

Hii @miguelpruivo @Nolan1357 i also getting this issue. Please help. 这几天 我从 Dio File_path flutter_file_picker 找出问题 如果我发现了哪里出现的BUG 我会第一时间 发布

复制一下 就没问题了 static Future copyFile(String result) async{ File file = File(result); final documentPath = (await getApplicationDocumentsDirectory()).path; file = await file.copy('$documentPath/${path.basename(file.path)}'); print(file.path); print(file.existsSync()); return file; }

not working FileSystemException: Cannot copy file to '/var/mobile/Containers/Data/Application/96B6B6B1-C250-4770-B215-920D4D11B2B2/Documents/application-of-appendix-iii-to-marine-species.pdf', path = '/private/var/mobile/Containers/Data/Application/96B6B6B1-C250-4770-B215-920D4D11B2B2/tmp/-Inbox/application-of-appendix-iii-to-marine-species.pdf' (OS Error: No such file or directory, errno = 2)

miguelpruivo commented 2 years ago

That seems to be only happening occasionally with some and with a few files, does that happen for all files?

swapnilsinha17 commented 2 years ago

@miguelpruivo No it's not happening with all file ..sometime that file working fine sometime error happening with same file.

miguelpruivo commented 2 years ago

How long does it go between picking and the error?

swapnilsinha17 commented 2 years ago

@miguelpruivo not too much .. maximum 1 to 2 min i think the error is because of Inbox copy of that you created for file . Not 100 % sure Cannot retrieve length of file, path = '/private/var/mobile/Containers/Data/Application/31609356-B2FF-4E41-8576-D0D46E7D0DF3/tmp/com.loancloud.fund1-Inbox/form_template.pdf

swapnilsinha17 commented 2 years ago

@miguelpruivo Please check this issue

swapnilsinha17 commented 2 years ago

@miguelpruivo @jamesdixon @marchellodev @maxzod @Nolan1357

Please check this issue

when we take some time after uploading the pdf files the issue will come at merge. Look into the video https://drive.google.com/file/d/1jxsia1H2FL47HC6Zr8wzPGB7p7DJbAQh/view?usp=sharing

Android studio logs Launching lib/main.dart on Elint’s iPhone in debug mode... Automatically signing iOS for device deployment using specified development team in Xcode project: X7PXVCSP9H Running Xcode build... Xcode build done. 99.5s Installing and launching... (lldb) 2021-12-03 17:42:31.657268+0530 Runner[58593:3196859] [Firebase/Crashlytics] Version 8.0.0 8.0.0 - [Firebase/Analytics][I-ACS023007] Analytics v.8.0.0 started 8.0.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r) 8.0.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement 8.0.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled 8.0.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist [VERBOSE-2:FlutterObservatoryPublisher.mm(101)] Failed to register observatory port with mDNS with error -65555. [VERBOSE-2:FlutterObservatoryPublisher.mm(103)] On iOS 14+, local network broadcast in apps need to be declared in the app's Info.plist. Debug and profile Flutter apps and modules host VM services on the local network to support debugging features such as hot reload and DevTools. To make your Flutter app or module attachable and debuggable, add a '_dartobservatory._tcp' value to the 'NSBonjourServices' key in your Info.plist for the Debug/Profile configurations. For more information, see https://flutter.dev/docs/development/add-to-app/ios/project-setup#local-network-privacy-permissions [connection] nw_endpoint_handler_set_adaptive_read_handler [C1.1 2404:6800:4002:82c::200a.443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] unregister notification for read_timeout failed [connection] nw_endpoint_handler_set_adaptive_write_handler [C1.1 2404:6800:4002:82c::200a.443 ready channel-flow (satisfied (Path is satisfied), viable, interface: en0, ipv4, ipv6, dns)] unregister notification for write_timeout failed [VERBOSE-2:FlutterObservatoryPublisher.mm(101)] Failed to register observatory port with mDNS with error -65555. [VERBOSE-2:FlutterObservatoryPublisher.mm(103)] On iOS 14+, local network broadcast in apps need to be declared in the app's Info.plist. Debug and profile Flutter apps and modules host VM services on the local network to support debugging features such as hot reload and DevTools. To make your Flutter app or module attachable and debuggable, add a '_dartobservatory._tcp' value to the 'NSBonjourServices' key in your Info.plist for the Debug/Profile configurations. For more information, see https://flutter.dev/docs/development/add-to-app/ios/project-setup#local-network-privacy-permissions Debug service listening on ws://127.0.0.1:62003/4OG53LTeyk4=/ws Syncing files to device Elint’s iPhone... flutter: _appLocale Null en flutter: _kTestingCrashlytics false kReleaseMode false flutter: 375.0 [GETX] Instance "GetMaterialController" has been created [GETX] Instance "GetMaterialController" has been initialized

***** FilePicker canceled

Please check asap it's urgent. Thanks

miguelpruivo commented 2 years ago

What if you don’t pick files from the recents folder?

swapnilsinha17 commented 2 years ago

Let me check ... you mean browse folder?

swapnilsinha17 commented 2 years ago

@miguelpruivo Same issue occur.

miguelpruivo commented 2 years ago

How are you picking?

swapnilsinha17 commented 2 years ago

@miguelpruivo Please check this https://drive.google.com/file/d/1jxsia1H2FL47HC6Zr8wzPGB7p7DJbAQh/view?usp=sharing Here you will understand better.

After picking the pdf file take just few sec like 30 then next pdf file ...like this way issue will come.

If we continuously picking file one after another ..no issue occured

swapnilsinha17 commented 2 years ago

@miguelpruivo Please update

swapnilsinha17 commented 2 years ago

@miguelpruivo Please check . It's urgent

swapnilsinha17 commented 2 years ago

Hii @miguelpruivo did you check this?

miguelpruivo commented 2 years ago

I did, sorry, I don’t know how to help you right now as I don’t have the time to further investigate it.

Edit: try replicating it with the example app in the plugin to see if it happens.

sproutlyCaleb commented 2 years ago

I had a problem like this while trying to upload. I think the reason I was having trouble was that it takes time to copy the images to local storage, and since I was checking the length before the image was created it kept on failing. The way I fixed it was by creating a function to keep checking for the length until it finds it otherwise I would just retry my upload.


  Future<int> _getPhotoLength({int iteration = 0, required File file}) async {
    var length = file.readAsBytesSync().lengthInBytes;
    if (length > 0) {
      return length;
    }
    if (iteration == 3) {
      return 0;
    }
    await Future.delayed(Duration(seconds: iteration * 2));
    return _getPhotoLength(file: file, iteration: iteration + 1);
  }```
swapnilsinha17 commented 2 years ago

I did, sorry, I don’t know how to help you right now as I don’t have the time to further investigate it.

Edit: try replicating it with the example app in the plugin to see if it happens.

Okay i will check this

swapnilsinha17 commented 2 years ago

I had a problem like this while trying to upload. I think the reason I was having trouble was that it takes time to copy the images to local storage, and since I was checking the length before the image was created it kept on failing. The way I fixed it was by creating a function to keep checking for the length until it finds it otherwise I would just retry my upload.

  Future<int> _getPhotoLength({int iteration = 0, required File file}) async {
    var length = file.readAsBytesSync().lengthInBytes;
    if (length > 0) {
      return length;
    }
    if (iteration == 3) {
      return 0;
    }
    await Future.delayed(Duration(seconds: iteration * 2));
    return _getPhotoLength(file: file, iteration: iteration + 1);
  }```

Thanks i will try this

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

YDA93 commented 2 years ago

Same issue. Found irreproducible crash in crashalytics in ios device.

Everything working perfect in android but not ios.

This can't be replicated because it happens occasionally.

@Nolan1357 Did you find a workaround?

Elhan98 commented 2 years ago

Hi @miguelpruivo , I've the same problem. It seems that after 1/2 minutes that i picked the image, in the temporary storage that file is deleted becuse it isn't use. I think it's releted to this: https://stackoverflow.com/questions/62766286/temporary-files-are-being-removed-during-execution-on-ios. For example if i pick one image, get the path, then wait 1/2 minutes and try to get that image by the path , it goes in error because it has been deleted

SerdarYildiz06 commented 2 years ago

I am trying to post local phone asset but I am taking "FileSystemException (FileSystemException: Cannot retrieve length of file, path = 'cache/file_picker/IMG_20220428_115542.jpg' (OS Error: Permission denied, errno = 13))". This error. What is the main problem?

rizkiiansyah commented 1 year ago

Any update?

gibahjoe commented 1 year ago

I just experienced this issue or similar issue

/Users/[redacted]/Library/Developer/CoreSimulator/Devices/B3A65624-67B1-45B3-AB3E-18268068212C/data/Containers/Data/Application/090BFD9E-6EF0-40D1-92C5-4820D930DDCB/tmp/[redacted]/jwkwjwi_iwiwi.pdf' (OS Error: No such file or directory, errno = 2)
#0      _File.throwIfError (dart:io/file_impl.dart:629:7)
#1      _File.openSync (dart:io/file_impl.dart:473:5)
#2      _File.readAsBytesSync (dart:io/file_impl.dart:533:18)

I discovered it happens after using hot reload.

Just incase anyone has similar issues.

oguz-bektas commented 1 year ago

Your App name code (31609356-B2FF-4E41-8576-D0D46E7D0DF3) changes at each run. This issue happens when you save the name code locally and try to read from previous name path (31609356-B2FF-4E41-8576-D0D46E7D0DF3)