grafana/k6 · error

failed to ingest request metadatas batch: code=

Error message

failed to ingest request metadatas batch: code=%s, msg=%s

What it means

Returned by IngestRequestMetadatasBatch when the gRPC BatchCreateRequestMetadatas RPC fails: the grpc status is converted and reported with its code and message, e.g. context deadline exceeded, unavailable ingester, or auth failure.

Solutions

  1. Check the gRPC code in the message: Unavailable/DeadlineExceeded usually indicate load or timeouts — the built-in retry config may help
  2. Verify ingester host, TLS, and auth token configuration
  3. Increase the insights client timeout for large batches
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/cloudapi/insights/client.go:185 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/43968205f8ef3800. Report an issue: GitHub.

Appendix: source

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

	if closed {
		return ErrClientClosed
	}

	if len(requestMetadatas) < 1 {
		return nil
	}

	req, err := newBatchCreateRequestMetadatasRequest(requestMetadatas)
	if err != nil {
		return fmt.Errorf("failed to create request from request metadatas: %w", err)
	}

	ctx, cancel := context.WithTimeout(ctx, c.cfg.Timeout)
	defer cancel()
	_, err = c.client.BatchCreateRequestMetadatas(ctx, req)
	if err != nil {
		st := status.Convert(err)
		return fmt.Errorf("failed to ingest request metadatas batch: code=%s, msg=%s", st.Code().String(), st.Message())
	}

	return nil
}

// Close closes the client.
func (c *Client) Close() error {
	c.connMu.Lock()
	defer c.connMu.Unlock()

	if c.conn == nil {
		return ErrClientClosed
	}

	conn := c.conn
	c.client = nil
	c.conn = nil

View on GitHub (pinned to 01ffac6f24)