{"record":{"id":"ed120a5a13588f4b","repo":"dotnet/runtime","slug":"unknown-object-id-objid","errorCode":null,"errorMessage":"Unknown object id ${objId}","messagePattern":"Unknown object id (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mono/browser/runtime/debug.ts","lineNumber":238,"sourceCode":"    });\n    return proxy;\n}\n\nexport function mono_wasm_call_function_on (request: CallRequest): CFOResponse {\n    forceThreadMemoryViewRefresh();\n\n    if (request.arguments != undefined && !Array.isArray(request.arguments))\n        throw new Error(`\"arguments\" should be an array, but was ${request.arguments}`);\n\n    const objId = request.objectId;\n    const details = request.details;\n    let proxy: any = {};\n\n    if (objId.startsWith(\"dotnet:cfo_res:\")) {\n        if (objId in _call_function_res_cache)\n            proxy = _call_function_res_cache[objId];\n        else\n            throw new Error(`Unknown object id ${objId}`);\n    } else {\n        proxy = _create_proxy_from_object_id(objId, details);\n    }\n\n    const fn_args = request.arguments != undefined ? request.arguments.map(a => JSON.stringify(a.value)) : [];\n\n    const fn_body_template = `const fn = ${request.functionDeclaration}; return fn.apply(proxy, [${fn_args}]);`;\n    const fn_defn = new Function(\"proxy\", fn_body_template);\n    const fn_res = fn_defn(proxy);\n\n    if (fn_res === undefined)\n        return { type: \"undefined\" };\n\n    if (Object(fn_res) !== fn_res) {\n        if (typeof (fn_res) == \"object\" && fn_res == null)\n            return { type: typeof (fn_res), subtype: `${fn_res}`, value: null };\n        return { type: typeof (fn_res), description: `${fn_res}`, value: `${fn_res}` };\n    }","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/mono/browser/runtime/debug.ts#L220-L256","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  return mono_wasm_call_function_on(request);\n} catch (e) {\n  if (String(e).includes('Unknown object id')) {\n    // stale cfo_res handle; re-acquire via a fresh callFunctionOn/evaluate\n    return { type: 'undefined' };\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["debugger","cdp","object-cache","devtools"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}