dotnet/runtime · error · Error

Could not find any object with id

Error message

Could not find any object with id ${objectId}

What it means

Thrown by `_get_cfo_res_details` when asked to describe an object id that is not in `_call_function_res_cache`. This is the lookup path used by the inspector to enumerate properties of a previously returned call-function-on result; an unknown id means the cached object is gone.

Solutions

  1. Drop cached object references whenever the runtime re-initialises; listen for the runtime-ready signal and clear.
  2. Avoid keeping inspector trees expanded across reloads; collapse them before reloading the page.
  3. If the id was never produced by a real call-function-on response, do not pass it to details.

Example fix

// before: kept id across reload
_get_cfo_res_details(staleId, args); // throws

// after: invalidate ids on runtime-ready
mono_wasm_runtime_ready(); // runtime clears _call_function_res_cache
const fresh = await mono_wasm_call_function_on({ objectId: rootId, ... });
_get_cfo_res_details(fresh.objectId, args);
Defensive patterns

Strategy: validation

Validate before calling

function canGetCfoDetails (objectId) {
  return typeof objectId === 'string' && objectId in _call_function_res_cache_pub;
}

Type guard

function isCachedObjectId (objId: string, cache: Record<string, unknown>): objId is string {
  return Object.prototype.hasOwnProperty.call(cache, objId);
}

Try / catch

try {
  return _get_cfo_res_details(objectId, args);
} catch (e) {
  if (e instanceof Error && /Could not find any object/.test(e.message)) {
    // refresh the object reference and retry once
    const fresh = await mono_wasm_call_function_on({ objectId: rootId, ... });
    return _get_cfo_res_details(fresh.objectId, args);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling the internal details helper (debug.ts:283) with an `objectId` not present in `_call_function_res_cache`. Triggered when the inspector asks for properties of an object whose cache entry was cleared by `mono_wasm_runtime_ready`, or that was issued by a different runtime instance.

Common situations: Inspector tree open while the runtime reloads; the page navigated/reloaded but DevTools kept stale object references; concurrent inspector sessions sharing ids.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/89a2191f2addbb3b. Report an issue: GitHub.

Appendix: source

Thrown at src/mono/browser/runtime/debug.ts:285

            subtype: "array",
            className: "Array",
            description: `Array(${fn_res.length})`,
            objectId: fn_res_id
        };
    }
    if (fn_res.value !== undefined || fn_res.subtype !== undefined) {
        return fn_res;
    }

    if (fn_res == proxy)
        return { type: "object", className: "Object", description: "Object", objectId: objId };
    const fn_res_id = _cache_call_function_res(fn_res);
    return { type: "object", className: "Object", description: "Object", objectId: fn_res_id };
}

function _get_cfo_res_details (objectId: string, args: any): ValueAsJsonString {
    if (!(objectId in _call_function_res_cache))
        throw new Error(`Could not find any object with id ${objectId}`);

    const real_obj = _call_function_res_cache[objectId];

    const descriptors = Object.getOwnPropertyDescriptors(real_obj);
    if (args.accessorPropertiesOnly) {
        Object.keys(descriptors).forEach(k => {
            if (descriptors[k].get === undefined)
                Reflect.deleteProperty(descriptors, k);
        });
    }

    const res_details: any[] = [];
    Object.keys(descriptors).forEach(k => {
        let new_obj;
        const prop_desc = descriptors[k];
        if (typeof prop_desc.value == "object") {
            // convert `{value: { type='object', ... }}`
            // to      `{ name: 'foo', value: { type='object', ... }}

View on GitHub (pinned to 60108ba66e)