dotnet/runtime · error · Error
Unknown object id ${objId}
Error message
Unknown object id ${objId} What it means
Thrown by mono_wasm_call_function_on() in debug.ts when request.objectId starts with the prefix 'dotnet:cfo_res:' (meaning it references a cached call-function-on result) but is not present in the in-memory _call_function_res_cache. Results from previous Runtime.callFunctionOn calls are cached by an incrementing id (dotnet:cfo_res:N); referencing one that was never created or was released via mono_wasm_release_object fails here.
Source
Thrown at src/mono/browser/runtime/debug.ts:238
});
return proxy;
}
export function mono_wasm_call_function_on (request: CallRequest): CFOResponse {
forceThreadMemoryViewRefresh();
if (request.arguments != undefined && !Array.isArray(request.arguments))
throw new Error(`"arguments" should be an array, but was ${request.arguments}`);
const objId = request.objectId;
const details = request.details;
let proxy: any = {};
if (objId.startsWith("dotnet:cfo_res:")) {
if (objId in _call_function_res_cache)
proxy = _call_function_res_cache[objId];
else
throw new Error(`Unknown object id ${objId}`);
} else {
proxy = _create_proxy_from_object_id(objId, details);
}
const fn_args = request.arguments != undefined ? request.arguments.map(a => JSON.stringify(a.value)) : [];
const fn_body_template = `const fn = ${request.functionDeclaration}; return fn.apply(proxy, [${fn_args}]);`;
const fn_defn = new Function("proxy", fn_body_template);
const fn_res = fn_defn(proxy);
if (fn_res === undefined)
return { type: "undefined" };
if (Object(fn_res) !== fn_res) {
if (typeof (fn_res) == "object" && fn_res == null)
return { type: typeof (fn_res), subtype: `${fn_res}`, value: null };
return { type: typeof (fn_res), description: `${fn_res}`, value: `${fn_res}` };
}View on GitHub (pinned to 290d5ab72c)
Solutions
- Re-acquire the object id from a fresh Runtime.callFunctionOn / evaluation before operating on it.
- Avoid calling mono_wasm_release_object on ids you still intend to use.
- Reload the page if ids are stale after a navigation/restart.
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
null
Type guard
null
Try / catch
try {
return mono_wasm_call_function_on(request);
} catch (e) {
if (String(e).includes('Unknown object id')) {
// stale cfo_res handle; re-acquire via a fresh callFunctionOn/evaluate
return { type: 'undefined' };
}
throw e;
} Prevention
- Re-acquire object ids from fresh evaluations before use.
- Do not call mono_wasm_release_object on ids you still reference.
- Treat ids as session-scoped; they do not survive reloads.
When it happens
Trigger: A CDP client sending Runtime.callFunctionOn with an objectId from a previous session/page load (the cache is in-memory and resets per page). Calling against an id after mono_wasm_release_object freed it. A client fabricating an objectId string.
Common situations: DevTools reusing object handles across a page reload or after the object group was released. Long-lived inspector sessions in a test harness that assume stable object ids.
Related errors
- Could not find any object with id ${objectId}
- Failed on mono_wasm_send_dbg_command_with_parms
- Failed on mono_wasm_send_dbg_command
- "arguments" should be an array, but was ${request.arguments}
- Failed on mono_wasm_get_dbg_command_info
AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06).
Data as JSON: /api/errors/ed120a5a13588f4b.
Report an issue: GitHub.