grafana/k6 · error

getting properties for element with ID

Error message

getting properties for element with ID %s: %w

What it means

Wrap of the CDP Runtime.getProperties command in BaseJSHandle.getProperties: listing the remote object's own properties failed at the protocol level. The %s is the remote object ID. Common causes: the object was already released (handle disposed, or garbage-collected after a heap snapshot/navigation), the session or execution context was destroyed, or the browser target crashed.

Solutions

  1. Re-query the handle before calling getProperties if navigation occurred
  2. Call handle.getProperties() before dispose() and before further page activity
  3. Check that the page and browser session are still alive
  4. Avoid holding handles across long-running page interactions that trigger GC
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/js_handle.go:177 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/73b0602d8dfc6912. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/js_handle.go:177

	handles, err := h.getProperties()
	if err != nil {
		return nil, err
	}

	jsHandles := make(map[string]JSHandleAPI, len(handles))
	for k, v := range handles {
		jsHandles[k] = v
	}

	return jsHandles, nil
}

// getProperties is like GetProperties, but does not panic.
func (h *BaseJSHandle) getProperties() (map[string]jsHandle, error) {
	act := runtime.GetProperties(h.remoteObject.ObjectID).WithOwnProperties(true)
	result, _, _, _, err := act.Do(cdp.WithExecutor(h.ctx, h.session)) //nolint:dogsled
	if err != nil {
		return nil, fmt.Errorf("getting properties for element with ID %s: %w",
			h.remoteObject.ObjectID, err)
	}

	props := make(map[string]jsHandle, len(result))
	for _, r := range result {
		if !r.Enumerable {
			continue
		}
		props[r.Name] = NewJSHandle(h.ctx, h.session, h.execCtx, h.execCtx.Frame(), r.Value, h.logger)
	}

	return props, nil
}

// JSONValue returns a JSON version of this JS handle.
func (h *BaseJSHandle) JSONValue() (string, error) {
	remoteObject := h.remoteObject
	if remoteObject.ObjectID != "" {

View on GitHub (pinned to 01ffac6f24)