Skip to content

Bad state: Failed to find package_config.json on Flutter's master channel #4888

@rrousselGit

Description

@rrousselGit

Context: I'm trying to use build_runner on Freezed using Flutter's master channel.
But I get the following exception:

remirousselet@mac freezed % dart run build_runner watch -d            
Unhandled exception:
Bad state: Failed to find package_config.json.
#0      BuildPackagesLoader.forPaths (package:build_runner/src/build_plan/build_packages_loader.dart:36:7)
#1      BuildPackages.forPaths (package:build_runner/src/build_plan/build_packages.dart:178:32)
#2      loadBuilderFactories (package:build_runner/src/bootstrap/build_script_generate.dart:71:45)
#3      generateBuildScript (package:build_runner/src/bootstrap/build_script_generate.dart:23:34)
#4      Bootstrapper._writeBuildScript (package:build_runner/src/bootstrap/bootstrapper.dart:171:31)
#5      Bootstrapper.run (package:build_runner/src/bootstrap/bootstrapper.dart:69:13)
#6      BuildRunner._runWithBuilders (package:build_runner/src/build_runner.dart:218:31)
#7      BuildRunner._runOrThrow (package:build_runner/src/build_runner.dart:109:20)
<asynchronous suspension>
#8      BuildRunner.run (package:build_runner/src/build_runner.dart:51:14)
<asynchronous suspension>
#9      main (file:///Users/remirousselet/.pub-cache/hosted/pub.dev/build_runner-2.14.0/bin/build_runner.dart:11:7)
<asynchronous suspension>

Freezed is not using workspaces.

pwd is:
<path/to/freezed>/packages/freezed

There's a packages/freezed/.dart_tool/package_config.json (but no <root>/.dart_tool/package_config.json). My guess is that build_runner is incorrectly trying to obtain the package_config from the root

Note

build_runner appears to be creating a .dart_tool at the root of the git repository. I don't have any pubspec at the root of the project, so there's no reason for build_runner to create one there.
Specifically, it is creating a <root>/.dart_tool/build/lock/build_runner.workspace.lock

This could be related to the fact that I have an analysis_options.yaml at the root of the project, but no associated pubspec.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions