diff --git a/tools/remotecommand/fallback.go b/tools/remotecommand/fallback.go index 78620d33..50332308 100644 --- a/tools/remotecommand/fallback.go +++ b/tools/remotecommand/fallback.go @@ -52,7 +52,7 @@ func (f *FallbackExecutor) Stream(options StreamOptions) error { // initial primary call to upgrade to a websocket connection fails. func (f *FallbackExecutor) StreamWithContext(ctx context.Context, options StreamOptions) error { err := f.primary.StreamWithContext(ctx, options) - if f.shouldFallback(err) { + if err != nil && f.shouldFallback(err) { klog.V(4).Infof("RemoteCommand fallback: %v", err) return f.secondary.StreamWithContext(ctx, options) }