BigPizzaV3/CodexPlusPlus · error · Error

当前 Codex 版本的 API 适配器不兼容,请更新对话脉络脚本

Error message

当前 Codex 版本的 API 适配器不兼容,请更新对话脉络脚本

What it means

nativeApiRequest depends on loadNativeRuntime() to bind to the host app's versioned runtime. If loading the native runtime throws (bindings missing for this Codex build), the function raises this local error telling the user the current Codex version's API adapter is incompatible and the canvas script needs updating.

Solutions

  1. Update the 对话脉络 (conversation canvas) script to the latest version supporting the installed Codex build
  2. Check the script's release notes for the minimum supported Codex version
  3. Pin/downgrade Codex to a supported version if the script update is unavailable
  4. Report/extend the runtime binding map in native-api.js for the new Codex version

Example fix

// before
try{native=await loadNativeRuntime();}catch{throw localError('当前 Codex 版本的 API 适配器不兼容,请更新对话脉络脚本');}
// after
try{native=await loadNativeRuntime();}catch(e){console.warn('native runtime load failed',e);throw localError('当前 Codex 版本的 API 适配器不兼容,请更新对话脉络脚本');}
Defensive patterns

Strategy: fallback

Validate before calling

async function runtimeCompatible(){try{const n=await loadNativeRuntime();return !!n;}catch{return false;}}

Type guard

const hasRuntime=(n)=>n!=null&&typeof n==='object';

Try / catch

try{await nativeApiRequest(url,opts);}catch(e){if(e.canvasApiLocal&&/适配器不兼容/.test(e.message)){notifyUpdateRequired();}else throw e;}

Prevention

When it happens

Trigger: Any nativeApiRequest call where loadNativeRuntime() rejects/throws — the Codex app version has no matching runtime binding map for the canvas script's expected exports.

Common situations: Codex desktop app auto-updated to a version the canvas script doesn't support; obfuscated binding names (lGt, cGt, jR) changed between Codex releases; script not updated after a Codex upgrade.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

Thrown at tools/conversation-canvas/src/native-api.js:5

// HTTP uses the app host, with versioned runtime bindings, not renderer fetch/CSP.
async function nativeApiRequest(url,options){
  const localError=message=>Object.assign(Error(message),{canvasApiLocal:true});
  let native;
  try{native=await loadNativeRuntime();}catch{throw localError('当前 Codex 版本的 API 适配器不兼容,请更新对话脉络脚本');}
  if(typeof native.lGt!=='function')throw localError('当前 Codex 版本未提供兼容的 HTTP 服务');
  native.lGt();
  const client=native.cGt?.getInstance?.();
  if(typeof client?.fetch!=='function'||!native.jR?.httpFetch)throw localError('当前 Codex 的 HTTP 服务尚未就绪,请稍后重试');
  const {onProgress,...fetchOptions}=options;
  const response=await client.fetch(url,fetchOptions);
  return readApiResponse(response,options.signal,onProgress);
}

View on GitHub (pinned to b1ed92e5e4)