diff --git a/internal/client/client.go b/internal/client/client.go index e43a561aa6..f8486baa75 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -545,7 +545,9 @@ func (a *APIClient) SwitchContext(name string) error { if err := a.config.SwitchContext(name); err != nil { return err } - if err := a.invalidateCache(); err != nil { + if !a.getConnOK() { + log.Debug().Msg("No cache to invalidate") + } else if err := a.invalidateCache(); err != nil { return err } a.reset()