BigPizzaV3/CodexPlusPlus · error · Error

当前任务的原生接口尚未就绪,请等待任务加载后点击刷新

Error message

当前任务的原生接口尚未就绪,请等待任务加载后点击刷新

What it means

After scanning DOM and React fibers for the task's scope and manager, nativeContext throws this error if either the scope or the request manager was not found — the app's native task context has not mounted yet, so history reading cannot proceed.

Solutions

  1. Wait for the task/conversation to fully load, then click refresh
  2. Re-open the conversation and retry the canvas read
  3. Reload the Codex page if the UI appears loaded but the error persists
  4. If it always fails after a Codex update, update the script's fiber/scope discovery logic

Example fix

// before
if(!scope||!manager)throw Error('当前任务的原生接口尚未就绪,请等待任务加载后点击刷新');
// after
if(!scope||!manager){await new Promise(r=>setTimeout(r,2000));}
if(!scope||!manager)throw Error('当前任务的原生接口尚未就绪,请等待任务加载后点击刷新');
Defensive patterns

Strategy: retry

Validate before calling

if(!scope||!manager){await waitFor(()=>nativeContextProbe(),15000);/* then proceed */}

Type guard

const contextReady=(ctx)=>!!ctx&&!!ctx.scope&&!!ctx.manager;

Try / catch

try{await nativeContext(id);}catch(e){if(/尚未就绪/.test(e.message)){await sleep(2500);return refresh();}throw e;}

Prevention

When it happens

Trigger: nativeContext runs while the conversation view hasn't finished mounting: no matching scope in navigation entries, no manager resolvable from fibers/domVisited surfaces, or diagnostic native_context_lookup reports managerFound:false / scope missing.

Common situations: Clicking canvas refresh immediately after opening a task before React mounts the thread view; navigating between tasks while the lookup runs; Codex UI changes break the fiber-walk heuristics so the manager is never discovered.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/96b3ddc33637c072. Report an issue: GitHub.

Appendix: source

Thrown at tools/conversation-canvas/src/native-sidechat.js:69

      if(fiber.tag===22&&fiber.memoizedState!==null)continue;
      inspect(fiber);if(fiber.child)stack.push(fiber.child);
    }
  }
  // Prefer a callback sharing the matching route-scope subtree. History reads
  // do not require a composer or a side-conversation callback at all.
  let scope=null,create=null,manager=null,parent=null;
  for(const candidate of scopes){
    const found=native.ESt(candidate.scope,threadId),conversation=found?.getConversation(threadId);
    if(!conversation)continue;
    scope=candidate.scope;manager=found;parent=conversation;
    const matching=callbacks.find(entry=>{
      for(let fiber=entry.fiber;fiber;fiber=fiber.return)if(fiber===candidate.fiber)return true;
      return false;
    });
    if(matching){create=matching.create;break;}
  }
  if(typeof diagnostic==='function')diagnostic('native_context_lookup',{domCount:domVisited.size,fiberCount:visited.size,scopeCount:scopes.length,callbackFound:!!create,managerFound:!!manager});
  if(!scope||!manager)throw Error('当前任务的原生接口尚未就绪,请等待任务加载后点击刷新');
  // The thread list can use the app-wide scope while the composer uses a
  // derived route scope. Its memo dependency still identifies the exact task.
  const matchingNavigation=navigation.find(entry=>entry.scope===scope)||(navigation.length===1?navigation[0]:null);
  return {native,scope,create,manager,parent,navigation:matchingNavigation?.adapter};
}
function nativeMessageTarget(doc,id){
  const direct=doc.getElementById(id);if(direct)return direct;
  const encoded=encodeURIComponent(id);
  return [...doc.querySelectorAll('[data-local-conversation-item-target-ids]')].find(element=>(element.getAttribute('data-local-conversation-item-target-ids')||'').split(' ').includes(encoded))||null;
}
function nativeTurns(conversation){
  if(!conversation)return [];
  const history=conversation.turnHistory;
  const turns=history?.kind==='canonical'?Object.values(history.history.entitiesByKey):conversation.turns||[];
  return [...turns,...(conversation.turns||[])];
}
const organizerModel='gpt-5.6-luna';
const organizerEffort='medium';

View on GitHub (pinned to b1ed92e5e4)