diff --git a/bundle/deploy/lock/acquire.go b/bundle/deploy/lock/acquire.go index 18778aa5dd9..1335f7800c2 100644 --- a/bundle/deploy/lock/acquire.go +++ b/bundle/deploy/lock/acquire.go @@ -2,8 +2,11 @@ package lock import ( "context" + "errors" + "fmt" "github.com/databricks/cli/bundle" + "github.com/databricks/cli/libs/filer" "github.com/databricks/cli/libs/locker" "github.com/databricks/cli/libs/log" ) @@ -47,6 +50,13 @@ func (m *acquire) Apply(ctx context.Context, b *bundle.Bundle) error { err = b.Locker.Lock(ctx, force) if err != nil { log.Errorf(ctx, "Failed to acquire deployment lock: %v", err) + + notExistsError := filer.NoSuchDirectoryError{} + if errors.As(err, ¬ExistsError) { + // If we get a "doesn't exist" error from the API this indicates + // we either don't have permissions or the path is invalid. + return fmt.Errorf("cannot write to deployment root (this can indicate a previous deploy was done with a different identity): %s", b.Config.Workspace.RootPath) + } return err }