diff --git a/cli/lakeflags/flags.go b/cli/lakeflags/flags.go index 11566e78eb..b4678fba3c 100644 --- a/cli/lakeflags/flags.go +++ b/cli/lakeflags/flags.go @@ -11,6 +11,7 @@ import ( "github.com/brimdata/zed/api/client" "github.com/brimdata/zed/api/client/auth0" + "github.com/brimdata/zed/lake" "github.com/brimdata/zed/lake/api" "github.com/brimdata/zed/pkg/storage" "go.uber.org/zap" @@ -73,7 +74,11 @@ func (l *Flags) Open(ctx context.Context) (api.Interface, error) { } return api.NewRemoteLake(conn), nil } - return api.OpenLocalLake(ctx, zap.Must(zap.NewProduction()), uri.String()) + lk, err := api.OpenLocalLake(ctx, zap.Must(zap.NewProduction()), uri.String()) + if errors.Is(err, lake.ErrNotExist) { + return nil, fmt.Errorf("%w\n(hint: run 'zed init' to initialize lake at this location)", err) + } + return lk, err } func (l *Flags) AuthStore() *auth0.Store { diff --git a/cmd/zed/ztests/init-hint.yaml b/cmd/zed/ztests/init-hint.yaml new file mode 100644 index 0000000000..8fd6e8b288 --- /dev/null +++ b/cmd/zed/ztests/init-hint.yaml @@ -0,0 +1,10 @@ +script: | + ! zed -lake=path/to/zed ls + +outputs: + - name: stderr + regexp: | + .* lake does not exist + \(hint: run 'zed init' to initialize lake at this location\) + - name: stdout + data: ""