grafana/k6 · error

failed to dial

Error message

failed to dial: %w

What it means

Wrapped error from the Insights client's Dial: grpc.DialContext to the configured ingester host failed within the connect timeout. The cause may be DNS, network, TLS, or authentication failure to the Insights ingester service.

Solutions

  1. Verify the K6_INSIGHTS_INGESTER_HOST (or equivalent) address is reachable
  2. Check network/firewall and TLS settings for the ingester endpoint
  3. Increase the connect timeout if the ingester is slow to accept connections
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/cloudapi/insights/client.go:153 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/c2a9b0b19e1bacb0. Report an issue: GitHub.

Appendix: source

Thrown at internal/cloudapi/insights/client.go:153

func (c *Client) Dial(ctx context.Context) error {
	c.connMu.Lock()
	defer c.connMu.Unlock()

	if c.conn != nil {
		return ErrClientAlreadyInitialized
	}

	opts, err := dialOptionsFromClientConfig(c.cfg)
	if err != nil {
		return fmt.Errorf("failed to create dial options: %w", err)
	}

	ctx, cancel := context.WithTimeout(ctx, c.cfg.ConnectConfig.Timeout)
	defer cancel()

	conn, err := grpc.DialContext(ctx, c.cfg.IngesterHost, opts...) //nolint:staticcheck
	if err != nil {
		return fmt.Errorf("failed to dial: %w", err)
	}

	c.client = ingester.NewIngesterServiceClient(conn)
	c.conn = conn

	return nil
}

// IngestRequestMetadatasBatch ingests a batch of request metadatas.
func (c *Client) IngestRequestMetadatasBatch(ctx context.Context, requestMetadatas RequestMetadatas) error {
	c.connMu.RLock()
	closed := c.conn == nil
	c.connMu.RUnlock()
	if closed {
		return ErrClientClosed
	}

	if len(requestMetadatas) < 1 {

View on GitHub (pinned to 01ffac6f24)