Skip to content

http_req_failed metric displays pass/fail counts reversed despite 0% failure rate #5679

@keshavpdl

Description

@keshavpdl

Brief summary

Description:
When running a test with no failed HTTP requests (http_req_failed rate = 0.00%), the k6 CLI raw output and JSON results show the http_req_failed pass and fail counts reversed. Specifically, the failure rate is correctly reported as 0.00%, but the pass count is shown as 0 and the fail count as the total number of requests, which is misleading.

Example snippet from raw output:

http_req_failed................: 0.00%   ✓ 0        ✗ 21
http_reqs......................: 21

Impact:
This can cause confusion interpreting test results, as the failure rate and counts appear inconsistent.

Additional notes:
The failure rate metric itself is correct, so this appears to be a display/reporting issue for the http_req_failed metric pass/fail counts.

SS:
Image

k6 version

k6 v1.6.1 (commit/2ac2bb560e, go1.25.6,)

OS

linux/amd64

Docker version and image (if applicable)

No response

Steps to reproduce the problem

  1. Create a simple k6 script that makes a number of HTTP requests, all expected to succeed. For example:
import http from 'k6/http';
import { check } from 'k6'; 
export default function () {
 const res = http.get('https://test-api.k6.io');
check(res, {
'status is 200': (r) => r.status === 200,
});
}
  1. Run the test with 20+ iterations (e.g., k6 run --iterations 21 script.js).
  2. Observe the CLI or JSON output for the http_req_failed metric:
    http_req_failed................: 0.00% ✓ 0 ✗ 21
    Note that the failure rate is 0.00% but pass count is 0 and fail count equals total requests.

Expected behaviour

  • Pass count (✓) should be equal to the total requests (21 in this case).
  • Fail count (✗) should be zero since failure rate is 0.00%.

Actual behaviour

  • Pass count is 0.
  • Fail count equals the total number of requests.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions