Does k6 has any way to kill/stop/abort vus from script after getting a response? In my case some vus (on or two from 5k) gets an empty body in response. From body I am extract the data for next portion of requests. I am prefer to exclude such vus from overall mass of vus instead of to get an errors in the follow requests.
Thanks.
p.s. yes I know that this is an application bug. But I need just to stop vus.
Hi @vitaliivershinin , welcome to the community forum!
Could you share a simplified / sanitized version of the script with us, so that we can better see what you want to achieve.
Hi @bandorko thank you for your response.
Don`t know how code below helps you to give me the answer. But asking a question a just want to know does k6 has any possibilities to break the VU from script. Only this 
eventIds
initialized once in the init code and reused in the default scenario function
//init VU code begin
//prepare getEventsQueryParams...
let getEventsResponse = eventsApi.getEvents(getEventsQueryParams);
let eventIds = eventHelper.getEventIds(getEventsResponse);
if(eventIds.length === 0) {
//stop/kill VU here...
}
//init VU code end
...
//default function
let eventId = eventIds[Math.floor(Math.random() * arr.length)];//error here because no any eventId in eventIds
eventsApi.getEventDetails(eventHelper.buildGetEventDetailsQuery(eventId));
@vitaliivershinin
My short answer is : I don’t think you have such an option to abort a specific VU without aborting the whole test. (Hope someone smarter will correct me, If I am not right)
But to try to solve your issue:
You said, that just some VUs get empty body. Are there anything, that prevents you to reinitialize the variables in the init code if the body is empty? (I don’t know how prepare getEventsQueryParams or getEvents() works, but if they return a new value on every call, this might work for you)
let getEventsResponse;
let eventIds;
do{
//prepare getEventsQueryParams...
getEventsResponse = eventsApi.getEvents(getEventsQueryParams);
eventIds = eventHelper.getEventIds(getEventsResponse);
}while(eventIds.length === 0)
Hi @vitaliivershinin 
As @bandorko mentioned, to my knowledge, you cannot stop/pause/kill vus during the test run based on a current condition.
You might already be using it, but it might also be worth looking into using a different executor to try and cater to your issue.
1 Like