Skip to content

Invalid argument(s) (sdkPath): Must not be null #2563

Closed

Description

@ditman

Environment

  • pub version or flutter pub version: Pub 2.9.0-21.0.dev.flutter-06183779d7
  • OS version: Linux 5.2.17-1rodete3-amd64 x86_64
  • Are you using the Chinese community mirror or a corporate firewall? No

Problem

When attempting to run pub publish --dry-run I get the following unexpected error: Invalid argument(s) (sdkPath): Must not be null

This seems to happen with any package. Check all publishable pre-submit runs in the flutter/plugins PRs.

Expected behavior

I'd expect the command to tell me if the package is publishable or not.

Actual behavior

The command errors out with the following error after listing all the files that are about to be "published":

Invalid argument(s) (sdkPath): Must not be null
dart:core                                                      ArgumentError.checkNotNull
package:analyzer/src/dart/analysis/context_builder.dart 49:19  ContextBuilderImpl.createContext
package:pub/src/dart.dart 115:36                               AnalysisContextManager.createContextsForDirectory
package:pub/src/validator/strict_dependencies.dart 27:28       new StrictDependenciesValidator
package:pub/src/validator.dart 135:7                           Validator.runAll
package:pub/src/command/lish.dart 165:21                       LishCommand._validate
package:pub/src/command/lish.dart 141:15                       LishCommand.run
package:args/command_runner.dart 197:27                        CommandRunner.runCommand
package:pub/src/command_runner.dart 193:39                     PubCommandRunner.runCommand.<fn>
dart:async                                                     new Future.sync
package:pub/src/utils.dart 113:12                              captureErrors.wrappedCallback
dart:async                                                     runZoned
package:pub/src/utils.dart 130:5                               captureErrors
package:pub/src/command_runner.dart 193:13                     PubCommandRunner.runCommand

--trace output

Here's the `--trace` run:
Publishing extension_google_sign_in_as_googleapis_auth 1.0.0 to https://pub.dartlang.org:
|-- .gitignore
...
|-- pubspec.yaml
'-- test
    '-- extension_google_sign_in_as_googleapis_auth_test.dart

Invalid argument(s) (sdkPath): Must not be null
dart:core                                                      ArgumentError.checkNotNull
package:analyzer/src/dart/analysis/context_builder.dart 49:19  ContextBuilderImpl.createContext
package:pub/src/dart.dart 115:36                               AnalysisContextManager.createContextsForDirectory
package:pub/src/validator/strict_dependencies.dart 27:28       new StrictDependenciesValidator
package:pub/src/validator.dart 135:7                           Validator.runAll
package:pub/src/command/lish.dart 165:21                       LishCommand._validate
package:pub/src/command/lish.dart 141:15                       LishCommand.run
package:args/command_runner.dart 197:27                        CommandRunner.runCommand
package:pub/src/command_runner.dart 193:39                     PubCommandRunner.runCommand.<fn>
dart:async                                                     new Future.sync
package:pub/src/utils.dart 113:12                              captureErrors.wrappedCallback
package:stack_trace                                            Chain.capture
package:pub/src/utils.dart 126:11                              captureErrors
package:pub/src/command_runner.dart 193:13                     PubCommandRunner.runCommand
===== asynchronous gap ===========================
dart:async                                                     Future.catchError
package:pub/src/utils.dart 113:52                              captureErrors.wrappedCallback
package:stack_trace                                            Chain.capture
package:pub/src/utils.dart 126:11                              captureErrors
package:pub/src/command_runner.dart 193:13                     PubCommandRunner.runCommand
---- Log transcript ----
FINE: Pub 2.9.0-21.0.dev.flutter-06183779d7
IO  : Spawning "git --version" in /usr/local/google/home/dit/github/plugins-origin/packages/google_sign_in/extension_google_sign_in_as_googleapis_auth/.
IO  : Finished git. Exit code 0.
    | stdout:
    | | git version 2.28.0.rc0.105.gf9edc3c819-goog
    | Nothing output on stderr.
FINE: Determined git command git.
IO  : Spawning "git check-ignore --quiet ." in /usr/local/google/home/dit/github/plugins-origin/packages/google_sign_in/extension_google_sign_in_as_googleapis_auth/.
IO  : Finished git. Exit code 1.
    | Nothing output on stdout.
    | Nothing output on stderr.
IO  : Spawning "git ls-files --cached --others --exclude-standard" in /usr/local/google/home/dit/github/plugins-origin/packages/google_sign_in/extension_google_sign_in_as_googleapis_auth/.
IO  : Finished git. Exit code 0.
    | stdout:
    | | .gitignore
...
    | | test/extension_google_sign_in_as_googleapis_auth_test.dart
    | Nothing output on stderr.
FINE: Archiving and publishing extension_google_sign_in_as_googleapis_auth 1.0.0 (.).
MSG : Publishing extension_google_sign_in_as_googleapis_auth 1.0.0 to https://pub.dartlang.org:
    | |-- .gitignore
...
    | '-- test
    |     '-- extension_google_sign_in_as_googleapis_auth_test.dart
FINE: Creating .tar.gz stream containing:
    | ./.gitignore
...
    | ./test/extension_google_sign_in_as_googleapis_auth_test.dart
IO  : Spawning "/bin/tar --format=ustar --create --gzip --directory /usr/local/google/home/dit/github/plugins-origin/packages/google_sign_in/extension_google_sign_in_as_googleapis_auth/. --files-from /dev/stdin --owner=pub --group=pub" in /usr/local/google/home/dit/github/plugins-origin/packages/google_sign_in/extension_google_sign_in_as_googleapis_auth/.
ERR : Invalid argument(s) (sdkPath): Must not be null
FINE: Exception type: ArgumentError
ERR : dart:core                                                      ArgumentError.checkNotNull
    | package:analyzer/src/dart/analysis/context_builder.dart 49:19  ContextBuilderImpl.createContext
    | package:pub/src/dart.dart 115:36                               AnalysisContextManager.createContextsForDirectory
    | package:pub/src/validator/strict_dependencies.dart 27:28       new StrictDependenciesValidator
    | package:pub/src/validator.dart 135:7                           Validator.runAll
    | package:pub/src/command/lish.dart 165:21                       LishCommand._validate
    | package:pub/src/command/lish.dart 141:15                       LishCommand.run
    | package:args/command_runner.dart 197:27                        CommandRunner.runCommand
    | package:pub/src/command_runner.dart 193:39                     PubCommandRunner.runCommand.<fn>
    | dart:async                                                     new Future.sync
    | package:pub/src/utils.dart 113:12                              captureErrors.wrappedCallback
    | package:stack_trace                                            Chain.capture
    | package:pub/src/utils.dart 126:11                              captureErrors
    | package:pub/src/command_runner.dart 193:13                     PubCommandRunner.runCommand
    | ===== asynchronous gap ===========================
    | dart:async                                                     Future.catchError
    | package:pub/src/utils.dart 113:52                              captureErrors.wrappedCallback
    | package:stack_trace                                            Chain.capture
    | package:pub/src/utils.dart 126:11                              captureErrors
    | package:pub/src/command_runner.dart 193:13                     PubCommandRunner.runCommand
---- End log transcript ----

Activity

  1. ditman commented on Jul 17, 2020

    @ditman
    MemberAuthor

    These are the versions used by the CI:

    Flutter 1.21.0-2.0.pre.51 • channel master • https://github.com/flutter/flutter.git
    Framework • revision df542b6831 (2 hours ago) • 2020-07-16 18:32:46 -0700
    Engine • revision d3b81f19fc
    Tools • Dart 2.9.0 (build 2.9.0-21.0.dev 06183779d7)

  2. jakemac53 commented on Jul 17, 2020

    @jakemac53
    Contributor

    Note that this has not yet been released, but the HEAD Dart SDK can not publish packages. We need to be sure this gets fixed before the next release.

  3. mkustermann commented on Jul 17, 2020

    @mkustermann
    Member
  4. ditman commented on Jul 17, 2020

    @ditman
    MemberAuthor

    Managed to reproduce the issue by checking out different revs of dart-sdk, building them with ninja, and then using that pub binary from the build output to test (~/github/engine/src/out/host_release/dart-sdk/bin/pub publish --dry-run).

    Start/end ranges for the bisect of third_party/dart determined in a flutter/flutter bisection: here.

    Bisected to this PR: https://dart-review.googlesource.com/c/sdk/+/154081

    git bisect log
    $ git bisect start
    $ git bisect bad cfeb1d647a
    $ git bisect good 20bf2fcf
    Bisecting: 10 revisions left to test after this (roughly 4 steps)
    [72bb1d1428e56b75e306d039e369f2b93405d8e0] Stop using FormalParameter.kind in analyzer.
    $ git bisect good
    Bisecting: 5 revisions left to test after this (roughly 3 steps)
    [e7f861023cf354c40a2de530fc5587d8b42e641a] Add dart.lineLength setting to the LSP docs
    $ git bisect bad
    Bisecting: 2 revisions left to test after this (roughly 1 step)
    [9bb4fb680ea9633bb1e0a432d1d0551bcb497d6d] Update the wrap-in-padding fix to not add the keyword const when in a constant context
    $ git bisect good
    Bisecting: 0 revisions left to test after this (roughly 1 step)
    [c3655ed435d6f72e3edb0114be9d567df3e708f9] Remove FolderBasedDartSdk.defaultSdkDirectory() and getSdkProperty().
    $ git bisect bad
    Bisecting: 0 revisions left to test after this (roughly 0 steps)
    [2b4dc0fa6b9f3a2fc271a5ac4fc81d9a0e14369e] update charcode in the sdk to the nnbd version
    $ git bisect good
    
    c3655ed435d6f72e3edb0114be9d567df3e708f9 is the first bad commit
    commit c3655ed435d6f72e3edb0114be9d567df3e708f9
    Author: Konstantin Shcheglov <[email protected]>
    Date:   Tue Jul 14 18:09:30 2020 +0000
    
        Remove FolderBasedDartSdk.defaultSdkDirectory() and getSdkProperty().
        
        It is up to the higher level clients to decide how to find SDK.
        
        It is not API, and is not referenced internally, so we can land it
        without going through breaking changes.
        
        Change-Id: Id428519fa9bb3c38368f095c0f358e07f65c45b4
        Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154081
        Reviewed-by: Brian Wilkerson <[email protected]>
        Commit-Queue: Konstantin Shcheglov <[email protected]>
    
     pkg/analysis_server/lib/src/server/driver.dart     |  7 +--
     .../integration/edit/import_elements_test.dart     |  6 +--
     pkg/analysis_server/tool/migration_runner.dart     |  6 +--
     pkg/analyzer/CHANGELOG.md                          |  5 ++
     pkg/analyzer/lib/src/command_line/arguments.dart   |  8 ++--
     .../dart/analysis/analysis_context_collection.dart |  3 ++
     .../lib/src/dart/analysis/context_builder.dart     | 14 ++----
     .../lib/src/dart/analysis/context_locator.dart     | 11 ++---
     pkg/analyzer/lib/src/dart/sdk/sdk.dart             | 54 ----------------------
     pkg/analyzer/pubspec.yaml                          |  2 +-
     .../test/src/command_line/arguments_test.dart      |  5 +-
     .../src/dart/analysis/context_builder_test.dart    | 11 +++--
     pkg/analyzer/tool/summary/build_sdk_summaries.dart |  6 +--
     13 files changed, 38 insertions(+), 100 deletions(-)
    
  5. jonasfj commented on Jul 20, 2020

    @jonasfj
    Member

    I guess this is yet another good reason move pub into the SDK repository..

  6. self-assigned this
    on Jul 20, 2020
  7. sigurdm commented on Jul 20, 2020

    @sigurdm
    Contributor

    cc @scheglov

    https://dart-review.googlesource.com/c/sdk/+/154081 seemingly made the sdkPath argument required in the implementation class.

    For unbreaking this we could provide an explicit sdkPath from pub.

  8. sigurdm commented on Jul 20, 2020

    @sigurdm
    Contributor
  9. ditman commented on Jul 20, 2020

    @ditman
    MemberAuthor

    Thanks @sigurdm!

  10. scheglov commented on Jul 20, 2020

    @scheglov
    Contributor
  11. ditman commented on Jul 20, 2020

    @ditman
    MemberAuthor

    I think once https://dart-review.googlesource.com/c/sdk/+/154940 rolls into flutter/master, the issue there can be closed as fixed. Thanks for the follow-up @scheglov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions