diff --git a/plan/plan.go b/plan/plan.go index 54de4eaa..042e4dfc 100644 --- a/plan/plan.go +++ b/plan/plan.go @@ -49,8 +49,12 @@ func Load(ctx context.Context, cfg Config) (*Plan, error) { if err != nil { errstring := err.Error() - if strings.Contains(errstring, "cannot find package") && strings.Contains(errstring, "alpha.dagger.io") { - return nil, ErrIncompatiblePlan + if strings.Contains(errstring, "cannot find package") { + if strings.Contains(errstring, "alpha.dagger.io") { + return nil, ErrIncompatiblePlan + } else if strings.Contains(errstring, pkg.DaggerModule) || strings.Contains(errstring, pkg.UniverseModule) { + return nil, fmt.Errorf("%w: running `dagger project update` may resolve this", err) + } } return nil, err diff --git a/tests/plan.bats b/tests/plan.bats index ac4e9430..8f20d3d7 100644 --- a/tests/plan.bats +++ b/tests/plan.bats @@ -46,6 +46,11 @@ setup() { assert_output --partial "attempting to load a dagger 0.1.0 project." } +@test "plan/do: missing packages suggests project update" { + run "$DAGGER" "do" -p ./plan/do/missing_dependencies.cue test + assert_output --partial ": running \`dagger project update\` may resolve this" +} + @test "plan/hello" { # Europa loader handles the cwd differently, therefore we need to CD into the tree at or below the parent of cue.mod cd "$TESTDIR" diff --git a/tests/plan/do/missing_dependencies.cue b/tests/plan/do/missing_dependencies.cue new file mode 100644 index 00000000..590ef311 --- /dev/null +++ b/tests/plan/do/missing_dependencies.cue @@ -0,0 +1,7 @@ +package main + +import ( + "dagger.io/daggggger" // intentionally misspelled to force error message +) + +dagger.#Plan