BigPizzaV3/CodexPlusPlus · error · Error

discovered.some(url=>!nativeBuilds[url.split('/').pop()])?'当…

Error message

discovered.some(url=>!nativeBuilds[url.split('/').pop()])?'当前 Codex 版本尚未适配对话脉络,请更新插件;已有整理结果仍保留':'Codex 原生模块加载失败,请重新加载应用后重试;已有整理结果仍保留'

What it means

createNativeLoader iterates discovered app-initial asset URLs, skipping unmapped filenames and import failures. If no module loads, it distinguishes two cases: if any discovered URL's filename is absent from nativeBuilds, the Codex version is unsupported (update plugin); otherwise imports themselves failed (reload the app). Both preserve existing organize results.

Solutions

  1. For the version message: update the plugin (or pin Codex) so nativeBuilds covers the discovered asset
  2. For the load-failure message: fully reload/restart the Codex application to restore importable assets
  3. Clear app caches if a partial update left stale app-initial assets
  4. Confirm network/app-shell health: asset URLs came from perf entries but import() failed — reinstall if it persists

Example fix

// before
throw Error(discovered.some(url=>!nativeBuilds[url.split('/').pop()])?'版本未适配':'加载失败');
// after (surface the underlying import error for diagnosis)
const lastError=errors[errors.length-1];
throw Object.assign(Error(discovered.some(url=>!nativeBuilds[url.split('/').pop()])
  ?'当前 Codex 版本尚未适配对话脉络,请更新插件;已有整理结果仍保留'
  :'Codex 原生模块加载失败,请重新加载应用后重试;已有整理结果仍保留'),{cause:lastError});
Defensive patterns

Strategy: try-catch

Validate before calling

const candidates=await nativeAssetCandidates();
if(candidates.length===0) throw new Error('no native assets discovered');
const mapped=candidates.filter(u=>nativeBuilds[u.split('/').pop()]);
if(mapped.length===0) throw new Error('plugin does not support this Codex build');

Type guard

function canBind(module,filename){ return !!nativeBuilds[filename] && !!module; }

Try / catch

try { runtime=await nativeGetRuntime() } catch(e){ if(String(e.message).includes('尚未适配')) promptPluginUpdate(); else if(String(e.message).includes('加载失败')) promptAppReload(); else throw e; }

Prevention

When it happens

Trigger: nativeGetRuntime called when (a) discovered assets include an unmapped app-initial-*.js filename → version-mismatch message, or (b) all mapped assets exist but every import(url) threw (app shell broken/cached assets missing) → reload message.

Common situations: Codex updated beyond plugin support (case a), or a corrupted/partially-updated app install where assets are discoverable via performance entries but fail to import (case b).

Related errors


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

Appendix: source

Thrown at tools/conversation-canvas/public/canvas.user.js:382

  // Keep live bindings: initialization populates the HTTP class and services.
  for(const [key,value] of Object.entries(mapping))Object.defineProperty(adapter,key,{get:()=>module[value]});
  return adapter;
}
function createNativeLoader({discover=nativeAssetCandidates,importModule=url=>import(url)}={}){
  let pending;
  return function load(){
    if(!pending)pending=(async()=>{
      const discovered=discover();
      // Without resource timing (e.g. after a reload), try reviewed builds only.
      const candidates=discovered.length?discovered:Object.keys(nativeBuilds).reverse().map(name=>'app://-/assets/'+name);
      for(const url of candidates){
        const filename=url.split('/').pop();
        if(!nativeBuilds[filename])continue;
        let module;
        try{module=await importModule(url);}catch{continue;}
        return bindNativeRuntime(module,filename);
      }
      throw Error(discovered.some(url=>!nativeBuilds[url.split('/').pop()])
        ?'当前 Codex 版本尚未适配对话脉络,请更新插件;已有整理结果仍保留'
        :'Codex 原生模块加载失败,请重新加载应用后重试;已有整理结果仍保留');
    })().catch(error=>{pending=null;throw error;});
    return pending;
  };
}
const loadNativeRuntime=createNativeLoader();


function isExportSizeError(message){
  return /超过.*(?:大小|限制)|too (?:large|big)|size.{0,30}limit|maximum.{0,20}size/i.test(String(message));
}

// Wire contracts verified in the installed Desktop's history loader:
// thread/turns/list(itemsView=notLoaded), then thread/items/list per turn.
async function readNativeHistory(send,threadId,cache=new Map(),onProgress=()=>{},signal){
  const turns=[],turnIds=new Set(),turnCursors=new Set();
  let cursor=null;

View on GitHub (pinned to b1ed92e5e4)