grafana/k6 · error
external module names must be prefixed with '%s', tried to r
Error message
external module names must be prefixed with '%s', tried to register: %s
What it means
Error "external module names must be prefixed with '%s', tried to register: %s" thrown in grafana/k6.
Source
Thrown at js/modules/modules.go:23
"context"
"fmt"
"strings"
"github.com/grafana/sobek"
"go.k6.io/k6/v2/ext"
"go.k6.io/k6/v2/js/common"
"go.k6.io/k6/v2/lib"
)
const extPrefix string = "k6/x/"
// Register the given mod as an external JavaScript module that can be imported
// by name. The name must be unique across all registered modules and must be
// prefixed with "k6/x/", otherwise this function will panic.
func Register(name string, mod any) {
if !strings.HasPrefix(name, extPrefix) {
panic(fmt.Errorf("external module names must be prefixed with '%s', tried to register: %s", extPrefix, name))
}
ext.Register(name, ext.JSExtension, mod)
}
// Module is the interface js modules should implement in order to get access to the VU
type Module interface {
// NewModuleInstance will get modules.VU that should provide the module with a way to interact with the VU.
// This method will be called for *each* VU that imports the module *once* per that VU.
NewModuleInstance(VU) Instance
}
// Instance is what a module needs to return
type Instance interface {
Exports() Exports
}
// VU gives access to the currently executing VU to a module InstanceView on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at js/modules/modules.go:23 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/3d0255dc30572409.
Report an issue: GitHub.