Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tool] flutter doctor throws FormatException: Unexpected extension byte when using IntelliJ IDEA 2021.3 and Dart plugin #94060

Closed
woprandi opened this issue Nov 22, 2021 · 48 comments · Fixed by #96325
Assignees
Labels
c: crash Stack traces logged to the console customer: crowd Affects or could affect many people, though not necessarily a specific customer. found in release: 2.5 Found to occur in 2.5 found in release: 2.6 Found to occur in 2.6 found in release: 2.8 Found to occur in 2.8 has reproducible steps The issue has been confirmed reproducible and is ready to work on P1 High-priority issues at the top of the work list r: fixed Issue is closed as already fixed in a newer version t: flutter doctor Problem related to the "flutter doctor" tool tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@woprandi
Copy link
Contributor

Steps to Reproduce

  1. Install new IntelliJ IDEA 2021.3 RC and Dart plugin
  2. Run flutter doctor

Expected results:

No problem with doctor

Actual results:

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)

The crash come from https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/intellij/intellij.dart#L130 with Dart.jar as file

Logs
flutter doctor 
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.6.0-12.0.pre.790, on Fedora Linux 35 (KDE Plasma) 5.14.18-300.fc35.x86_64, locale fr_FR.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2021.2)
[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
[✓] VS Code (version 1.62.3)
[✓] Connected device (2 available)

! Doctor found issues in 2 categories.

@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Nov 24, 2021
@danagbemava-nc danagbemava-nc changed the title flutter doctor crash with new IntelliJ IDEA and Dart plugin [tool] flutter doctor crash throws FormatException: Unexpected extension byte when using IntelliJ IDEA 2021.3 RC and Dart plugin Nov 24, 2021
@danagbemava-nc danagbemava-nc changed the title [tool] flutter doctor crash throws FormatException: Unexpected extension byte when using IntelliJ IDEA 2021.3 RC and Dart plugin [tool] flutter doctor throws FormatException: Unexpected extension byte when using IntelliJ IDEA 2021.3 RC and Dart plugin Nov 24, 2021
@danagbemava-nc
Copy link
Member

flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale en-GB)
    • Flutter version 2.5.3 at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (6 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1788:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:318:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:199:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1428:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1863:10)
      #15     runZonedGuarded (dart:async/zone.dart:1851:12)
      #16     runZoned (dart:async/zone.dart:1782:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:200:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:304:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:47)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1274:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:92:3)
      <asynchronous suspension>


[✓] VS Code (version 1.62.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (4 available)
    • M2007J20CG (mobile)    • 5dd3be00                  • android-arm64  • Android 11 (API 30)
    • Nexus’ IPhone (mobile) • 00008020-001875E83A38002E • ios            • iOS 15.0.2 19A404
    • macOS (desktop)        • macos                     • darwin-arm64   • macOS 11.6 20G165 darwin-arm
    • Chrome (web)           • chrome                    • web-javascript • Google Chrome 96.0.4664.55

! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 2.6.0-12.0.pre.826, on macOS 11.6 20G165 darwin-arm, locale en-GB)
    • Flutter version 2.6.0-12.0.pre.826 at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6c1455a23a (11 hours ago), 2021-11-23 21:13:05 -0500
    • Engine revision 539239e256
    • Dart version 2.16.0 (build 2.16.0-42.0.dev)
    • DevTools version 2.8.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:351:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1426:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1861:10)
      #15     runZonedGuarded (dart:async/zone.dart:1849:12)
      #16     runZoned (dart:async/zone.dart:1780:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:198:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:302:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:48)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1320:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:94:3)
      <asynchronous suspension>


[✓] VS Code (version 1.62.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (4 available)
    • M2007J20CG (mobile)    • 5dd3be00                  • android-arm64  • Android 11 (API 30)
    • Nexus’ IPhone (mobile) • 00008020-001875E83A38002E • ios            • iOS 15.0.2 19A404
    • macOS (desktop)        • macos                     • darwin-arm64   • macOS 11.6 20G165 darwin-arm
    • Chrome (web)           • chrome                    • web-javascript • Google Chrome 96.0.4664.55

! Doctor found issues in 1 category.
[✓] Flutter (Channel beta, 2.8.0-3.1.pre, on macOS 11.6 20G165 darwin-arm, locale en-GB)
    • Flutter version 2.8.0-3.1.pre at /Users/nexus/dev/sdks/flutter_beta
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3dab555040 (12 days ago), 2021-11-12 11:50:00 -0800
    • Engine revision 09f1520e8b
    • Dart version 2.15.0 (build 2.15.0-268.8.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
    • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
      #1      Utf8Decoder.convert (dart:convert/utf.dart:318:42)
      #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
      #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
      #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
      #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
      #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
      #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
      #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
      #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
      #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
      #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
      #12     _rootRun (dart:async/zone.dart:1428:13)
      #13     _CustomZone.run (dart:async/zone.dart:1328:19)
      #14     _runZoned (dart:async/zone.dart:1863:10)
      #15     runZonedGuarded (dart:async/zone.dart:1851:12)
      #16     runZoned (dart:async/zone.dart:1782:12)
      #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
      #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:197:9)
      #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:301:47)
      #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:47)
      #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1289:12)
      <asynchronous suspension>
      #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1140:27)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
      <asynchronous suspension>
      #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
      <asynchronous suspension>
      #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
      <asynchronous suspension>
      #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
      <asynchronous suspension>
      #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
      <asynchronous suspension>
      #30     main (package:flutter_tools/executable.dart:93:3)
      <asynchronous suspension>


[✓] VS Code (version 1.62.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (4 available)
    • M2007J20CG (mobile)    • 5dd3be00                  • android-arm64  • Android 11 (API 30)
    • Nexus’ IPhone (mobile) • 00008020-001875E83A38002E • ios            • iOS 15.0.2 19A404
    • macOS (desktop)        • macos                     • darwin-arm64   • macOS 11.6 20G165 darwin-arm
    • Chrome (web)           • chrome                    • web-javascript • Google Chrome 96.0.4664.55

! Doctor found issues in 1 category.

@danagbemava-nc danagbemava-nc added found in release: 2.5 Found to occur in 2.5 found in release: 2.6 Found to occur in 2.6 found in release: 2.8 Found to occur in 2.8 has reproducible steps The issue has been confirmed reproducible and is ready to work on c: crash Stack traces logged to the console t: flutter doctor Problem related to the "flutter doctor" tool tool Affects the "flutter" command-line tool. See also t: labels. and removed in triage Presently being triaged by the triage team labels Nov 24, 2021
@woprandi
Copy link
Contributor Author

The 2021.3 is now the current stable version

@christopherfujino christopherfujino self-assigned this Nov 30, 2021
@christopherfujino
Copy link
Member

christopherfujino commented Nov 30, 2021

This appears to be a failure while decoding a zipped file inside dart.jar. action item for myself: we should catch FormatException and then fail the validator, hinting that their editor installation is likely corrupted (or maybe just their extension)

@christopherfujino christopherfujino added the P2 Important issues not at the top of the work list label Nov 30, 2021
@woprandi woprandi changed the title [tool] flutter doctor throws FormatException: Unexpected extension byte when using IntelliJ IDEA 2021.3 RC and Dart plugin [tool] flutter doctor throws FormatException: Unexpected extension byte when using IntelliJ IDEA 2021.3 and Dart plugin Dec 1, 2021
@woprandi
Copy link
Contributor Author

woprandi commented Dec 2, 2021

It's strange since the extension seems to work as usual

@christopherfujino
Copy link
Member

christopherfujino commented Dec 2, 2021

@stevemessick do you have any insight in to why we're failing to decode a zip within dart.jar?

@stevemessick
Copy link
Member

I don't have any direct knowledge. I'd assume it (the Dart code) needs to unpack the META-INF/plugin.xml file from Dart.jar and look at the tag. Perhaps the file encoding changed in 2021.3? If the Dart plugin works (and it must if Flutter does) then the Dart.jar file itself is probably fine.

@noordawod

This comment has been minimized.

@AlexV525 AlexV525 added customer: crowd Affects or could affect many people, though not necessarily a specific customer. P1 High-priority issues at the top of the work list and removed P2 Important issues not at the top of the work list labels Dec 11, 2021
@TahaTesser
Copy link
Member

TahaTesser commented Dec 14, 2021

@christopherfujino @stevemessick

I just tried to read the same jar files from IntelliJ IDEA 2021.3 stable
Looks like dart.jar cannot be read, while flutter-intellij-63.1.4.jar reads just fine using archive, which is used in intellij.dart.

https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/intellij/intellij.dart#L5

As you can see archive sample code. just reading Dart.jar throws the error.

Code sample

import 'dart:io';
import 'package:archive/archive.dart';
import 'package:archive/archive_io.dart';

void main() {
  // final Archive archive = ZipDecoder().decodeBytes(File('assets/flutter-intellij-63.1.4.jar').readAsBytesSync());
  final Archive archive = ZipDecoder().decodeBytes(File('assets/Dart.jar').readAsBytesSync());

  // print('intellij plugin: ${archive.files}');
  print('dart plugin: ${archive.files}');
}
  assets:
    - assets/Dart.jar
    - assets/flutter-intellij-63.1.4.jar

Logs

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FormatException: Unexpected extension byte (at offset 5)
#0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
#1      Utf8Decoder.convert (dart:convert/utf.dart:351:42)
#2      InputStream.readString
package:archive/…/util/input_stream.dart:207
#3      new ZipDirectory.read
package:archive/…/zip/zip_directory.dart:40
#4      ZipDecoder.decodeBuffer
package:archive/src/zip_decoder.dart:19
#5      ZipDecoder.decodeBytes
package:archive/src/zip_decoder.dart:14
#6      main
package:triage/main.dart:7
#7      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:130:25)
#8      _rootRun (dart:async/zone.dart:1426:13)
#9      _CustomZone.run (dart:async/zone.dart:1328:19)
#10     _runZoned (dart:async/zone.dart:1861:10)
#11     runZonedGuarded (dart:async/zone.dart:1849:12)
#12     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:126:5)
#13     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#14     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

Intellij code sample

import 'dart:io';
import 'package:archive/archive.dart';
import 'package:archive/archive_io.dart';

void main() {
  final Archive archive = ZipDecoder().decodeBytes(File('assets/flutter-intellij-63.1.4.jar').readAsBytesSync());
  // final Archive archive = ZipDecoder().decodeBytes(File('assets/Dart.jar').readAsBytesSync());

  print('intellij plugin: ${archive.files}');
  // print('dart plugin: ${archive.files}');
}

Logs (no error)

flutter: intellij plugin: [META-INF/, META-INF/MANIFEST.MF]

Jar assets location

    Directory: C:\Users\Taha\StudioProjects\triage\assets


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        12/14/2021  10:35 AM        5876573 Dart.jar
-a----        12/14/2021  10:35 AM            261 flutter-intellij-63.1.4.jar

Related brendan-duncan/archive#158

@tvkoz
Copy link

tvkoz commented Jan 9, 2022

@noordawod, you can do as instructed to purge local changes.
Otherwise, "cd" to FLUTTER_HOME and execute "git reset --hard; git clean -fd". Then "flutter doctor -v" will build the flutter tools once again, but will produce the initial error as well.
At this point you are free to do "flutter upgrade", if the error persists, then simply repeat the above "patch".

@noordawod
Copy link
Contributor

noordawod commented Jan 10, 2022

Well, I know how to "forget" the patch. I was interested more to know how to "keep the patch" while still being able to upgrade Flutter without the need to re-patch.

@TahaTesser
Copy link
Member

TahaTesser commented Jan 10, 2022

Hi everyone
I can confirm updating archive in tools does solve the issue (thanks @brendan-duncan for fixing the archive issue, details in #96018)
This change should be landed by #96325, thanks for the patience

[✓] IntelliJ IDEA Community Edition (version 2021.3.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 63.2.4
    • Dart plugin version 213.5744.122

@TahaTesser TahaTesser added the waiting for PR to land (fixed) A fix is in flight label Jan 10, 2022
@jmagman jmagman linked a pull request Jan 11, 2022 that will close this issue
8 tasks
@jmagman
Copy link
Member

jmagman commented Jan 11, 2022

Fixed by #96325.

@omidshojaee

This comment has been minimized.

@TylerMutai

This comment has been minimized.

@danagbemava-nc
Copy link
Member

To anyone else who experiences this issue on stable 2.8.1, the fix for this is on the master channel and it should roll out to stable sometime in the future.

Please be patient.

Thank you

@johnaaronrose
Copy link

johnaaronrose commented Jan 21, 2022

I do not understand how to fix this bug. I've tried running 'flutter update-packages --force-upgrade' as sort-of-instructed in #96018. That completes Ok but 'flutter doctor' still gives the same problem. Could someone please put simple instructions on this thread detailing how to fix this bug?

@omidshojaee
Copy link

omidshojaee commented Jan 21, 2022 via email

@johnaaronrose
Copy link

Thanks, omidshojaee. I don't have any choice if I want to install flutter. Do you know when the fix will be deployed on stable? Presumably, I can switch back to stable by running "flutter channel stable" when the fix is deployed to stable: is that correct?

@danagbemava-nc
Copy link
Member

danagbemava-nc commented Jan 21, 2022

Hi @johnaaronrose, you should be able to install and use flutter just fine in spite of that error. Is there anything you're running into that is preventing you from installing/using flutter?

@omidshojaee
Copy link

omidshojaee commented Jan 21, 2022 via email

@omidshojaee
Copy link

omidshojaee commented Jan 21, 2022 via email

@johnaaronrose
Copy link

johnaaronrose commented Jan 21, 2022

I want to use flutter & dart and the instructions (at https://docs.flutter.dev/get-started/install/linux) say to use IntelliJ Idea as well as having Android Studio installed. The flutter installation instructions (at https://docs.flutter.dev/get-started/install/linux) say "fix this problem and then rerun flutter doctor":
[☠] IntelliJ IDEA Community Edition (the doctor check crashed)
✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us
know about this issue at https://github.com/flutter/flutter/issues.
✗ FormatException: Unexpected extension byte (at offset 5)

Also, when I try "flutter channel master", I get a lot of output including:
git: error: Your local changes to the following files would be overwritten by checkout:
git: Please commit your changes or stash them before you switch branches.
git: Aborting
Switching channels failed with error code 1.

I have NO experience of git, so I don't know what to do. Please advise.

@jmagman
Copy link
Member

jmagman commented Jan 21, 2022

As @danagbemava-nc politely said, #96325 is available on the master channel. Which means at some point in the future it will be available in a future beta and stable release. You can follow along with that commit to see what tags are added, which will tell you which release it will be in https://github.com/flutter/flutter/wiki/Where's-my-Commit%3F#finding-the-versions-that-contain-framework-commit-x

See our documentation at https://docs.flutter.dev/development/tools/sdk/upgrading#switching-flutter-channels for how to change to the master channel, if you would like the fix before it reaches stable. update-packages --force-upgrade has absolutely nothing to do with changing channels.

If you continue to see this issue, or are seeing an unrelated issue with changing channels, please file a new GitHub issue.

Locking.

@flutter flutter locked as resolved and limited conversation to collaborators Jan 21, 2022
@timsneath
Copy link
Contributor

timsneath commented Feb 13, 2022

Seeing quite a few instances of this; is it something that we might be able to cherry-pick, @jmagman? If not, then LMK and we can add a temporary note to the install instructions that this version is incompatible.

@christopherfujino
Copy link
Member

Seeing quite a few instances of this; is it something that we might be able to cherry-pick, @jmagman? If not, then LMK and we can add a temporary note to the install instructions that this version is incompatible.

Let me look into the feasibility of cherry-picking this (pub package cherrypicks are tricky)

@christopherfujino
Copy link
Member

christopherfujino commented Feb 14, 2022

Seeing quite a few instances of this; is it something that we might be able to cherry-pick, @jmagman? If not, then LMK and we can add a temporary note to the install instructions that this version is incompatible.

Let me look into the feasibility of cherry-picking this (pub package cherrypicks are tricky)

I tried to just update package archive on the stable branch, but I was not able to version solve without pulling in several other transitive updates that also depend on package:archive (source_span, win32, path_provider_*, xdg_directories, possibly others). Thus I would classify this as a high risk cherrypick and would recommend against doing so.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console customer: crowd Affects or could affect many people, though not necessarily a specific customer. found in release: 2.5 Found to occur in 2.5 found in release: 2.6 Found to occur in 2.6 found in release: 2.8 Found to occur in 2.8 has reproducible steps The issue has been confirmed reproducible and is ready to work on P1 High-priority issues at the top of the work list r: fixed Issue is closed as already fixed in a newer version t: flutter doctor Problem related to the "flutter doctor" tool tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging a pull request may close this issue.