grafana/k6 · error

extracting value from remote object with ID

Error message

extracting value from remote object with ID %s: %w

What it means

Returned by ExecutionContext.eval (returnByValue path) when valueFromRemoteObject fails to deserialize the remote object's value into a Go any — the object's CDP type/serialization is unsupported or the session died mid-read. Object ID is included for correlation with debug logs.

Solutions

  1. Retry the evaluation if the failure coincided with navigation
  2. Return handles instead of values (returnByValue:false) for complex objects
  3. Check debug logs with the object ID for the underlying cause
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/execution_context.go:238 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/58937563804bf222. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/execution_context.go:238

		e.logger.Debugf("ExecutionContext:eval", "Unexpected DevTools server error: %v", err)
		return nil, err
	}
	if exceptionDetails != nil {
		return nil, fmt.Errorf("%s", parseExceptionDetails(exceptionDetails))
	}
	var res any
	if remoteObject == nil {
		e.logger.Debugf(
			"ExecutionContext:eval",
			"sid:%s stid:%s fid:%s ectxid:%d furl:%q remoteObject is nil",
			e.sid, e.stid, e.fid, e.id, e.furl)
		return res, nil
	}

	if opts.returnByValue {
		res, err = valueFromRemoteObject(apiCtx, remoteObject)
		if err != nil {
			return nil, fmt.Errorf(
				"extracting value from remote object with ID %s: %w",
				remoteObject.ObjectID, err)
		}
	} else if remoteObject.ObjectID != "" {
		// Note: we don't use the passed in apiCtx here as it could be tied to a timeout
		res = NewJSHandle(e.ctx, e.session, e, e.frame, remoteObject, e.logger)
	}

	return res, nil
}

// Based on: https://github.com/microsoft/playwright/blob/master/src/server/injected/injectedScript.ts
//
//go:embed js/injected_script.js
var injectedScriptSource string

//nolint:gochecknoglobals
var injectedScriptSourceWithSourceURL = `(() => {` + injectedScriptSource + `; return new InjectedScript();})()` +

View on GitHub (pinned to 01ffac6f24)