argoproj/argo-workflows · warning

plugin %s context cancelled while waiting for socket at %q:

Error message

plugin %s context cancelled while waiting for socket at %q: %w

What it means

While NewDriver polls for the plugin's unix socket (once per second, up to 120s), it selects on the caller's context. If the context is cancelled or its deadline expires during the wait, the driver aborts and wraps ctx.Err() so callers can distinguish cancellation from a genuine plugin-startup failure.

Source

Thrown at workflow/artifacts/plugin/plugin.go:68

		if !os.IsNotExist(statErr) {
			// If error is not due to missing file, fail immediately
			return nil, fmt.Errorf("plugin %s cannot stat unix socket at %q: %w", pluginName, socketPath, statErr)
		}

		// Socket doesn't exist yet, log at debug level and retry
		logger.WithFields(logging.Fields{
			"pluginName": pluginName,
			"socketPath": socketPath,
			"retry":      retry,
			"maxRetries": maxRetries,
		}).Debug(ctx, "plugin socket not found, retrying in 1s")

		// Use context-aware sleep
		select {
		case <-time.After(time.Second):
			// Continue to next iteration
		case <-ctx.Done():
			return nil, fmt.Errorf("plugin %s context cancelled while waiting for socket at %q: %w", pluginName, socketPath, ctx.Err())
		}
	}

	// If socket still doesn't exist after all retries, fail with error
	if !socketExists {
		return nil, fmt.Errorf("plugin %s expected unix socket at %q but it does not exist after waiting for %d seconds", pluginName, socketPath, maxRetries)
	}

	if (info.Mode() & os.ModeSocket) == 0 {
		logger.WithFields(logging.Fields{
			"pluginName": pluginName,
			"socketPath": socketPath,
			"mode":       info.Mode(),
		}).Warn(ctx, "plugin socket file exists but is not a unix socket")
	}
	logger.WithFields(logging.Fields{
		"pluginName": pluginName,
		"socketPath": socketPath,

View on GitHub (pinned to 35bff19146)

Solutions

  1. Increase the artifact plugin's connectionTimeoutSeconds in the workflow/plugin configuration
  2. Investigate why the plugin is slow to create its socket (image pull latency, init failures in plugin logs)
  3. Retry the artifact operation with a fresh, non-cancelled context
  4. Check whether the workflow/node was deliberately cancelled and treat this as expected cleanup, not a bug

Example fix

// before
plugin:
  name: my-plugin
  connectionTimeoutSeconds: 10
// after
plugin:
  name: my-plugin
  connectionTimeoutSeconds: 120
Defensive patterns

Strategy: retry

Validate before calling

select {
case <-ctx.Done():
    return ctx.Err() // bail out before calling NewDriver if already cancelled
default:
}
if connectionTimeout < 120*time.Second {
    // plugin may take up to 120s to bind; give the ctx at least that long
}

Try / catch

drv, err := plugin.NewDriver(ctx, name, path, timeout)
if err != nil {
    var ce context.CancelCauseError
    if errors.As(err, &ce) || errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
        // treat as cancellation: check whether the workflow was cancelled before retrying
    }
    return err
}

Prevention

When it happens

Trigger: NewDriver called with a ctx whose deadline (e.g. connectionTimeout or a step timeout) expires before the plugin creates its socket, or the caller/parent workflow cancels the context while the socket is still absent.

Common situations: Plugin container is slow to start (image pull, slow init) and the caller used a short connectionTimeoutSeconds; node/workflow cancellation racing plugin startup; test harness cancelling ctx early.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/2fff2b6855f820e2. Report an issue: GitHub.