{"record":{"id":"3d0255dc30572409","repo":"grafana/k6","slug":"external-module-names-must-be-prefixed-with-s","errorCode":null,"errorMessage":"external module names must be prefixed with '%s', tried to register: %s","messagePattern":"external module names must be prefixed with '(.+?)', tried to register: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"js/modules/modules.go","lineNumber":23,"sourceCode":"\t\"context\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/grafana/sobek\"\n\n\t\"go.k6.io/k6/v2/ext\"\n\t\"go.k6.io/k6/v2/js/common\"\n\t\"go.k6.io/k6/v2/lib\"\n)\n\nconst extPrefix string = \"k6/x/\"\n\n// Register the given mod as an external JavaScript module that can be imported\n// by name. The name must be unique across all registered modules and must be\n// prefixed with \"k6/x/\", otherwise this function will panic.\nfunc Register(name string, mod any) {\n\tif !strings.HasPrefix(name, extPrefix) {\n\t\tpanic(fmt.Errorf(\"external module names must be prefixed with '%s', tried to register: %s\", extPrefix, name))\n\t}\n\n\text.Register(name, ext.JSExtension, mod)\n}\n\n// Module is the interface js modules should implement in order to get access to the VU\ntype Module interface {\n\t// NewModuleInstance will get modules.VU that should provide the module with a way to interact with the VU.\n\t// This method will be called for *each* VU that imports the module *once* per that VU.\n\tNewModuleInstance(VU) Instance\n}\n\n// Instance is what a module needs to return\ntype Instance interface {\n\tExports() Exports\n}\n\n// VU gives access to the currently executing VU to a module Instance","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/js/modules/modules.go#L5-L41","documentation":"Error \"external module names must be prefixed with '%s', tried to register: %s\" thrown in grafana/k6.","triggerScenarios":"Thrown at js/modules/modules.go:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}