BigPizzaV3/CodexPlusPlus · error · Error

Codex++ 会话读取失败

Error message

Codex++ 会话读取失败

What it means

After the bridge call to /session/export returns, readCanvasSource requires result.status==='ok'. If the export failed with any message that is not the recognized export-size-limit error, it throws the bridge's message or the generic 'Codex++ 会话读取失败' fallback.

Solutions

  1. Click refresh to retry the export; transient backend failures often clear
  2. Confirm the session id is valid and the session still exists in Codex
  3. Check the Codex++ backend logs for the /session/export failure reason
  4. Update Codex++ if the Codex app was recently upgraded (response shape drift)

Example fix

// before
if(!isExportSizeError(result?.message))throw Error(result?.message||'Codex++ 会话读取失败');
// after
if(!result)throw Error('Codex++ 会话读取失败:桥接返回为空');
if(!isExportSizeError(result?.message))throw Error(result?.message||'Codex++ 会话读取失败');
Defensive patterns

Strategy: try-catch

Validate before calling

if(!result||result.status!=='ok'&&!isExportSizeError(result?.message)){/* treat as failure before proceeding */}

Type guard

const isOkExport=(r)=>!!r&&r.status==='ok'&&Array.isArray(r.messages||r.data);

Try / catch

try{const r=await bridge('/session/export',{session_id:id});}catch(e){if(isExportSizeError(e.message)){/*fall back to native paging*/}else{showToast('会话读取失败,请重试');}}

Prevention

When it happens

Trigger: __codexSessionDeleteBridge('/session/export',{session_id:id}) resolves with a payload lacking status:'ok' and whose message is not matched by isExportSizeError — e.g. backend returned an error object, unknown failure, or an empty/undefined result.

Common situations: Session id no longer exists on the backend; Codex backend API changed shape after an update; session export endpoint returned an unexpected error; result is undefined because the bridge swallowed the failure.

Related errors


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

Appendix: source

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

    }
    if(!target){$('jump-status').textContent=({revealed:'已展开所属轮次,但该消息仍被折叠或未显示。可先查看对应原文。',unavailable:'当前页面的历史定位尚未就绪。可先查看对应原文。','missing-turn':'该来源缺少轮次信息。可先查看对应原文。',failed:'原聊天轮次展开失败。可先查看对应原文。'})[navigationState];return;}
    closePanel();
    target.scrollIntoView({behavior:'smooth',block:'center'});
    target.animate([{outline:'2px solid #888',backgroundColor:'#8882'},{outline:'2px solid transparent',backgroundColor:'transparent'}],{duration:2000});
    $('jump-status').textContent='正在定位原聊天消息…';
    setTimeout(()=>{if(disposed||currentId()!==threadId)return;const r=target.getBoundingClientRect();$('jump-status').textContent=target.isConnected&&r.height>0&&r.bottom>0&&r.top<innerHeight?'已定位并高亮原聊天消息。':'消息已找到,滚动尚未完成。';},700);
  }
  async function readCanvasSource(id,signal,progress){
    if(!nativeReadTasks.has(id)){
      let result;
      try{
        if(typeof window.__codexSessionDeleteBridge!=='function')throw Error('Codex++ 会话接口尚未连接,请稍后点击刷新');
        let timer;
        try{result=await Promise.race([window.__codexSessionDeleteBridge('/session/export',{session_id:id}),new Promise((_,reject)=>{timer=setTimeout(()=>reject(Error('会话读取超时,请重试')),15000);})]);}
        finally{clearTimeout(timer);}
      }catch(error){if(!isExportSizeError(error.message))throw error;result={message:error.message};}
      if(result?.status==='ok')return result;
      if(!isExportSizeError(result?.message))throw Error(result?.message||'Codex++ 会话读取失败');
      nativeReadTasks.add(id);
    }
    signal.throwIfAborted();progress('会话较大,正在改用原生分页读取…');
    const {manager}=await nativeContext(id);
    const messages=await readNativeHistory((method,params)=>manager.sendRequest(method,params,{priority:'background',timeoutMs:15000}),id,historyCache,progress,signal);
    const signature=[];for(const message of messages){signal.throwIfAborted();signature.push(message.id+':'+await messageDigest(message));}
    return {status:'ok',kind:'canvas-messages',session_id:id,messages,content:signature.join('|')};
  }
  async function sync(force=false){
    const id=currentId();
    if(!id){historyAbort?.abort();requestSequence++;active='';pending=null;data=null;revision='';taskCanvas.context('');$('pending-tray').replaceChildren();$('transcript').replaceChildren();$('details').hidden=true;status('请打开具体任务。');return;}
    if(id!==active){
      historyAbort?.abort();taskCanvas.context(id);pendingOffset=0;pendingOpen=false;sourceState={page:0};collapsedByThread.set(active,collapsedNodes);collapsedNodes=collapsedByThread.get(id)||new Set();active=id;organizationStatus(organizing===id?'GPT-5.6 Luna · 中 · 正在后台整理…':'');requestSequence++;pending=null;data=null;revision='';selected=null;lastRead=0;
      $('pending-tray').replaceChildren();$('transcript').replaceChildren();$('details').hidden=true;$('subtitle').textContent='';$('title').textContent='当前对话';tab('map');
    }
    if(pending===id||(!force&&Date.now()-lastRead<5000))return;
    const seq=++requestSequence;pending=id;lastRead=Date.now();if(!data)status('正在读取当前对话…');
    const abort=new AbortController();historyAbort=abort;

View on GitHub (pinned to b1ed92e5e4)