Skip to content

Syntax errors with binary provisioning enabled cause k6 to exit with 255 instead of 107 #5127

@nadiamoe

Description

@nadiamoe

Brief summary

k6 used to exit with code 107 when presented with a script that contains a syntax error, such as https://github.com/grafana/sm-k6-runner/blob/949c68681e504287471cb728185d74c1b0e61fce/internal/integration/integration_test.go#L601-L604. Now it does not, and it exits with 255 instead.

Exit codes above 128 are usually reserved to the process terminating very abnormally due to unhandled signals.

k6 version

k6 v1.2.3 (commit/e4a5a88f7c, go1.24.6, linux/amd64)

OS

Arch linux (btw)

Docker version and image (if applicable)

No response

Steps to reproduce the problem

k6 run the following script:

export default function () {
  console.log("Hi there, I'm a log line!");
  if {
}

Expected behaviour

nadia@Nadiarch 󱃾 curry-admin@Curry
16:33:14 ~ $> clippaste | K6_AUTO_EXTENSION_RESOLUTION=false k6 run - --verbose
DEBU[0000] Logger format: TEXT
DEBU[0000] k6 version: v1.2.3 (commit/e4a5a88f7c, go1.24.6, linux/amd64)
DEBU[0000] Automatic extension resolution is disabled.

         /\      Grafana   /‾‾/
    /\  /  \     |\  __   /  /
   /  \/    \    | |/ /  /   ‾‾\
  /          \   |   (  |  (‾)  |
 / __________ \  |_|\_\  \_____/

DEBU[0000] Resolving and reading test '-'...
DEBU[0000] '-' resolved to 'file:///-' and successfully loaded 81 bytes!
DEBU[0000] Gathering k6 runtime options...
DEBU[0000] Initializing k6 runner for '-' (file:///-)...
DEBU[0000] Detecting test type for...                    test_path="file:///-"
DEBU[0000] Trying to load as a JS test...                test_path="file:///-"
DEBU[0000] Everything has finished, exiting k6 with an error!  error="could not initialize '-': could not load JS test 'file:///-': GoError: file:///-: Line 3:6 Unexpected token { (and 4 more errors)\n"
ERRO[0000] GoError: file:///-: Line 3:6 Unexpected token { (and 4 more errors)  hint="script exception"

nadia@Nadiarch 󱃾 curry-admin@Curry
16:33:14 ~ $> echo $?
107

Actual behaviour

nadia@Nadiarch 󱃾 curry-admin@Curry
16:32:36 ~ $> clippaste | k6 run - --verbose
DEBU[0000] Logger format: TEXT
DEBU[0000] k6 version: v1.2.3 (commit/e4a5a88f7c, go1.24.6, linux/amd64)
DEBU[0000] Automatic extension resolution is enabled.
DEBU[0000] Launcher is resolving and reading the test's script  source=sourceRootPath
ERRO[0000] Automatic extension resolution is enabled but it failed to analyze the dependencies. Please, make sure to report this issue by opening a bug report.  error="-:3:5 Expected \"(\" but found \"{\""
ERRO[0000] -:3:5 Expected "(" but found "{"

nadia@Nadiarch 󱃾 curry-admin@Curry
16:32:39 ~ $> echo $?
255

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions