{"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/60108ba66eb7d1d12f595480091b4ad80a24b172/src/mono/browser/runtime/debug.ts#L220-L256","documentation":"Thrown by `mono_wasm_call_function_on` when the requested `objectId` starts with `dotnet:cfo_res:` but is not present in the in-memory `_call_function_res_cache`. Each call-function-on result that returns an object/array is cached under a generated id; using an id after it was cleared (or that was never issued) is rejected because the proxy cannot reconstruct the underlying object.","triggerScenarios":"Calling `mono_wasm_call_function_on` (debug.ts:224) with an `objectId` shaped `dotnet:cfo_res:<n>` whose key is not in `_call_function_res_cache`. Happens when the cache was reset by `mono_wasm_runtime_ready` (which clears it), when the id came from a stale DevTools session, or when the caller fabricated the id.","commonSituations":"DevTools inspector reusing an object reference across a runtime restart; long-lived page that re-initialises the runtime; passing an id obtained from a different tab/runtime instance.","solutions":["Treat any runtime re-init (re-run of `mono_wasm_runtime_ready`) as invalidating all `dotnet:cfo_res:` ids; re-fetch them.","Avoid persisting object ids across DevTools sessions; refresh the inspector tree after a reload.","If you cache ids in client code, clear that cache when the runtime reloads."],"exampleFix":"// before: id cached across a runtime restart\nconst id = previousResult.objectId; // 'dotnet:cfo_res:3'\nawait restartRuntime();\nmono_wasm_call_function_on({ objectId: id, ... }); // throws\n\n// after: re-acquire the id after restart\nconst id = (await mono_wasm_call_function_on({ objectId: rootId, ... })).objectId;\nmono_wasm_call_function_on({ objectId: id, ... });","handlingStrategy":"validation","validationCode":"function isCachedCfoId (objId) {\n  return typeof objId === 'string' && objId.startsWith('dotnet:cfo_res:') && objId in _call_function_res_cache_pub;\n}\nif (isCachedCfoId(id)) mono_wasm_call_function_on({ objectId: id, ... });","typeGuard":"function isLiveCfoId (objId: string, cache: Record<string, unknown>): boolean {\n  return objId.startsWith('dotnet:cfo_res:') && Object.prototype.hasOwnProperty.call(cache, objId);\n}","tryCatchPattern":"try {\n  return mono_wasm_call_function_on(request);\n} catch (e) {\n  if (e instanceof Error && /Unknown object id/.test(e.message)) {\n    // re-acquire the object id from its root and retry once\n    const fresh = await mono_wasm_call_function_on({ objectId: rootId, functionDeclaration: 'fn', arguments: [] });\n    return mono_wasm_call_function_on({ ...request, objectId: fresh.objectId });\n  }\n  throw e;\n}","preventionTips":["Invalidate cached ids when the runtime re-initialises (listen for runtime-ready).","Refresh inspector trees after page reload instead of keeping stale references.","Never fabricate `dotnet:cfo_res:` ids; only use ids returned by prior calls."],"tags":["debugger","object-cache","cdp","lifecycle"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}