{"record":{"id":"f07226024aebfc33","repo":"grafana/k6","slug":"failed-to-create-request-from-request-metadatas","errorCode":null,"errorMessage":"failed to create request from request metadatas: %w","messagePattern":"failed to create request from request metadatas: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloudapi/insights/client.go","lineNumber":177,"sourceCode":"\treturn nil\n}\n\n// IngestRequestMetadatasBatch ingests a batch of request metadatas.\nfunc (c *Client) IngestRequestMetadatasBatch(ctx context.Context, requestMetadatas RequestMetadatas) error {\n\tc.connMu.RLock()\n\tclosed := c.conn == nil\n\tc.connMu.RUnlock()\n\tif closed {\n\t\treturn ErrClientClosed\n\t}\n\n\tif len(requestMetadatas) < 1 {\n\t\treturn nil\n\t}\n\n\treq, err := newBatchCreateRequestMetadatasRequest(requestMetadatas)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create request from request metadatas: %w\", err)\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, c.cfg.Timeout)\n\tdefer cancel()\n\t_, err = c.client.BatchCreateRequestMetadatas(ctx, req)\n\tif err != nil {\n\t\tst := status.Convert(err)\n\t\treturn fmt.Errorf(\"failed to ingest request metadatas batch: code=%s, msg=%s\", st.Code().String(), st.Message())\n\t}\n\n\treturn nil\n}\n\n// Close closes the client.\nfunc (c *Client) Close() error {\n\tc.connMu.Lock()\n\tdefer c.connMu.Unlock()\n","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/cloudapi/insights/client.go#L159-L195","documentation":"Wrapped error from IngestRequestMetadatasBatch: converting the batch of request metadata into the protobuf request (newBatchCreateRequestMetadatasRequest) failed before the gRPC call was made — typically malformed metadata such as invalid timestamps or fields that cannot be encoded.","triggerScenarios":"Thrown at internal/cloudapi/insights/client.go:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error to find which metadata field failed conversion","Ensure request metadata values (URLs, method, timestamps) are well-formed before enqueueing them"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}