grafana/k6 · error

a goModule instance is of not goModuleInstance type (got %T)

Error message

a goModule instance is of not goModuleInstance type (got %T). This is a k6 bug please report it (https://github.com/grafana/k6/issues)

What it means

Error "a goModule instance is of not goModuleInstance type (got %T). This is a k6 bug please report it (https://github.com/grafana/k6/issues)" thrown in grafana/k6.

Source

Thrown at js/modules/require_impl.go:93

		if err != nil {
			return nil, err
		}
		promise := rt.CyclicModuleRecordEvaluate(wm, ms.resolver.sobekModuleResolver)
		switch promise.State() {
		case sobek.PromiseStateRejected:
			err = promise.Result().Export().(error) //nolint:forcetypeassert
		case sobek.PromiseStateFulfilled:
		default:
			panic("TLA in go modules is not supported in k6 at the moment")
		}
		if err != nil {
			return nil, err
		}
		mi = rt.GetModuleInstance(wm)
	}
	gmi, ok := mi.(*goModuleInstance)
	if !ok {
		panic(fmt.Sprintf("a goModule instance is of not goModuleInstance type (got %T). "+
			"This is a k6 bug please report it (https://github.com/grafana/k6/issues)", mi))
	}
	return gmi, nil
}

// Resolve returns what the provided specifier will get resolved to if it was to be imported
// To be used by other parts to get the path
func (ms *ModuleSystem) Resolve(mr sobek.ModuleRecord, specifier string) (*url.URL, error) {
	if specifier == "" {
		return nil, errors.New("require() can't be used with an empty specifier")
	}

	baseModuleURL := ms.resolver.reversePath(mr)
	return ms.resolver.resolveSpecifier(baseModuleURL, specifier)
}

// CurrentlyRequiredModule returns the module that is currently being required.
// It is mostly used for old and somewhat buggy behaviour of the `open` call

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at js/modules/require_impl.go:93 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/08a59ace3b54b7bf. Report an issue: GitHub.