Repository navigation
[tool_crash] StateError: Bad state: dart pub deps --json had unexpected output: Expected field "devDependencies" to be a list, got "null" #158441
Copy link
Copy link
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 3.27Found to occur in 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyiOS applications specificallyplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
Command
flutter run --machine --start-paused -d d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e --devtools-server-address http://127.0.0.1:9103/ --target /Users/huynq/Desktop/demo/lib/main.dartSteps to Reproduce
-
Using Flutter master channel
My current Flutter setup uses alias like this:
# >>> Flutter >>> export PATH="/Users/huynq/Documents/GitHub/flutter/bin:$PATH" alias flutterm='/Users/huynq/Documents/GitHub/flutter_master/bin/flutter' alias flutterb='/Users/huynq/Documents/GitHub/flutter_beta/bin/flutter' alias flutter3223='/Users/huynq/Documents/GitHub/flutter3.22.3/bin/flutter' alias dartm='/Users/huynq/Documents/GitHub/flutter_master/bin/dart'
I'm on
3.27.0-1.0.pre.442currently and usingfluttermto reproduce this issue. The issue didn't appear before with this setup. -
Create a new Flutter project, then run on iOS app target, the issue does not appear on Android app target
-
You may encounter another error about Dart SDK like this:
StateError: Bad state: dart pub deps --json failed The current Dart SDK version is 3.5.4. Because demo requires SDK version ^3.7.0-123.0.dev, version solving failed.
Try to bypass this issue by update your
pubspec.yamlfile:From
environment: sdk: ^3.7.0-123.0.dev
To
environment: sdk: '>=3.2.3 <4.0.0'
-
Run on iOS app target again and see the crash
Analysis
- Looking at the error message, it has fallen to:
| fail('Expected field "$name" to be a list, got "$value"'); |
This was created by #157462 which was merged recently (cc @matanlurey for thoughts)
Logs
StateError: Bad state: dart pub deps --json had unexpected output: Expected field "devDependencies" to be a list, got "null"
#0 computeExclusiveDevDependencies.fail (package:flutter_tools/src/compute_dev_dependencies.dart:33:5)
#1 computeExclusiveDevDependencies.asListOrFail (package:flutter_tools/src/compute_dev_dependencies.dart:68:7)
#2 computeExclusiveDevDependencies (package:flutter_tools/src/compute_dev_dependencies.dart:117:39)
<asynchronous suspension>
#3 findPlugins (package:flutter_tools/src/flutter_plugins.dart:130:23)
<asynchronous suspension>
#4 refreshPluginsList (package:flutter_tools/src/flutter_plugins.dart:1061:32)
<asynchronous suspension>
#5 processPodsIfNeeded (package:flutter_tools/src/macos/cocoapod_utils.dart:31:3)
<asynchronous suspension>
#6 buildXcodeProject (package:flutter_tools/src/ios/mac.dart:280:3)
<asynchronous suspension>
#7 IOSDevice.startApp (package:flutter_tools/src/ios/devices.dart:488:44)
<asynchronous suspension>
#8 FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:483:33)
<asynchronous suspension>
#9 HotRunner.run.<anonymous closure> (package:flutter_tools/src/run_hot.dart:426:14)
<asynchronous suspension>
#10 Future.wait.<anonymous closure> (dart:async/future.dart:520:21)
<asynchronous suspension>
#11 HotRunner.run (package:flutter_tools/src/run_hot.dart:457:34)
<asynchronous suspension>
#12 AppDomain.launch.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:824:9)
<asynchronous suspension>
#13 AppDomain.launch (package:flutter_tools/src/commands/daemon.dart:822:5)
<asynchronous suspension>
#14 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:764:15)
<asynchronous suspension>
#15 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1450:27)
<asynchronous suspension>
#16 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#17 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#18 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:443:9)
<asynchronous suspension>
#19 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#20 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:386:5)
<asynchronous suspension>
#21 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:131:9)
<asynchronous suspension>
#22 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#23 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>[!] Flutter (Channel master, 3.27.0-1.0.pre.442, on macOS 15.0.1 24A348 darwin-x64, locale en-VN)
• Flutter version 3.27.0-1.0.pre.442 on channel master at /Users/huynq/Documents/GitHub/flutter_master
! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18071ec0a8 (3 hours ago), 2024-11-11 11:47:32 +0900
• Engine revision 9b4c3b3d55
• Dart version 3.7.0 (build 3.7.0-123.0.dev)
• DevTools version 2.41.0-dev.2
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/huynq/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = /Users/huynq/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 16.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16A242d
! CocoaPods 1.15.2 out of date (1.16.2 is recommended).
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• 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
• android-studio-dir = /Applications/Android Studio.app
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
[✓] Android Studio (version 2024.2)
• Android Studio at /Applications/Android Studio Ladybug.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 21.0.3+-79915915-b509.11)
[✓] IntelliJ IDEA Community Edition (version 2024.2.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 81.1.3
• Dart plugin version 242.22855.32
[✓] VS Code (version 1.95.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.100.0
[✓] Connected device (5 available)
• Pixel 7 (mobile) • 2B171FDH20084L • android-arm64 • Android 15 (API 35)
• iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios • iOS 15.8 19H370
• iPad (mobile) • 00008103-000A1464346A201E • ios • iOS 17.5.1 21F90
• macOS (desktop) • macos • darwin-x64 • macOS 15.0.1 24A348 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.117
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consolefound in release: 3.27Found to occur in 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyiOS applications specificallyplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Activity
yiiim commentedon Nov 11, 2024
#158370, related to this, when using flutter commands outside of environment variables, you may encounter this issue. A temporary solution is to set the flutter channel you are using as an environment variable.
huycozy commentedon Nov 11, 2024
@yiiim I see. Thanks for linking the PR. Looks like this is only reproduced on my setup with Flutter alias:
The 1st step was incorrect as the issue will not appear if I upgrade Flutter like that, will update the steps.
danagbemava-nc commentedon Nov 11, 2024
I see a similar crash on macOS. I have a setup similar to @huycozy
crash log
Flutter crash report.
Please report a bug at https://github.com/flutter/flutter/issues.
command
flutter run --machine --start-paused -d macos --devtools-server-address http://127.0.0.1:9102/ --target /Users/deanli/projects/resize/lib/main.dart
exception
StateError: Bad state: dart pub deps --json had unexpected output: Expected field "devDependencies" to be a list, got "null"
flutter doctor
rydmike commentedon Nov 12, 2024
Getting this issue as well after using latest 3.27 beta channel and latest master, with fvm and was pointed here by a link in the crash. Interesting, seems like I cannot build anything now, investigating more.
rydmike commentedon Nov 12, 2024
Got it resolved, user error in my case.
matanlurey commentedon Nov 12, 2024
Should be a straight-forward fix, thanks for flagging.
Allow `devDependencies` to be omitted and not cause a tool crash. (#1…
github-actions commentedon Nov 27, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.