grafana/k6 · error

109

109

Error message

unexpected k6 panic: %s
%s

What it means

Error "unexpected k6 panic: %s %s" thrown in grafana/k6.

Source

Thrown at internal/cmd/root.go:193

	return nil
}

func (c *rootCommand) execute() {
	ctx, cancel := context.WithCancel(c.globalState.Ctx)
	c.globalState.Ctx = ctx

	exitCode := -1
	defer func() {
		cancel()
		c.stopLoggers()
		c.globalState.OSExit(exitCode)
	}()

	defer func() {
		if r := recover(); r != nil {
			exitCode = int(exitcodes.GoPanic)
			err := fmt.Errorf("unexpected k6 panic: %s\n%s", r, debug.Stack())
			if c.loggerIsRemote {
				c.globalState.FallbackLogger.Error(err)
			}
			c.globalState.Logger.Error(err)
		}
	}()

	// Completion requests for unregistered extensions must bypass Execute:
	// cobra's __complete writes to stdout as a side-effect, and the
	// provisioned binary's output would append to it, producing double output.
	var err error
	if ext, ok := detectExtensionCompletion(c.cmd, c.globalState); ok {
		err = completeExtension(c.globalState, ext, newCacheProvisioner(c.globalState))
	} else {
		var executed *cobra.Command
		executed, err = c.cmd.ExecuteC()
		// Report subcommand usage after the command runs, regardless of its exit
		// error, so a failed subcommand is still counted.

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at internal/cmd/root.go:193 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/9ae742c235af950d. Report an issue: GitHub.