BigPizzaV3/CodexPlusPlus · error · Error

当前对话尚未读取完成,请稍后重试

Error message

当前对话尚未读取完成,请稍后重试

What it means

In the organize flow of canvas-panel, after awaiting sync(true) and a pending-settle wait, the code validates the freshly read data: it must contain messages, still match the requested thread id, and still be the currently active conversation. Any mismatch means the read didn't finish or the view switched, and this error is thrown before organizing.

Solutions

  1. Wait until the canvas shows the conversation fully loaded (status shows message count), then click 整理 again
  2. Re-open the conversation and let sync complete before organizing
  3. If using native paginated reads, wait for the pagination progress to finish
  4. Avoid switching conversations while organize is running
Defensive patterns

Strategy: validation

Validate before calling

function canOrganize(data,id){return !!data&&Array.isArray(data.messages)&&data.messages.length>0&&data.threadId===id&&currentId()===id;}

Type guard

const isReadySnapshot=(d,id)=>d?.threadId===id&&Array.isArray(d?.messages)&&d.messages.length>0;

Try / catch

try{await organize();}catch(e){if(e.message.includes('尚未读取完成')){setStatus('会话仍在加载,请稍后再试');}else throw e;}

Prevention

When it happens

Trigger: Calling organize when data is null or data.messages is empty, the sync finished for a different threadId than the requested id, or the user switched conversations (currentId()!==id) during the read.

Common situations: User clicks 整理 while a large session is still loading (native paginated read in progress); user rapidly switches between conversations; sync failed silently leaving stale/empty data; very long threads exceed the read timeout.

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/8288159db5745ac0. Report an issue: GitHub.

Appendix: source

Thrown at tools/conversation-canvas/src/canvas-panel.js:153

    if(active===id&&!organizing){
      $('organize').textContent=record?.job?'继续整理':record?.published?.done?'增量整理':'整理脉络';
      if(!data&&record?.job)organizationStatus(`已恢复整理进度 · 已保存 ${record.job.state.batchCount} 批,点击「继续整理」接续${record.job.kind==='rebuild'?';原任务树保留至重新整理完成':''}`);
    }
    if(record?.published){annotationCache.set(id,record.published);return;}
    try{const legacy=JSON.parse(localStorage.getItem(`conversation-canvas:organized:${id}`));if(legacy?.threadId===id&&Array.isArray(legacy.nodes))annotationCache.set(id,legacy);}catch{}
  }
  function organizationStatus(text){$('organization-status').hidden=!text;$('organization-status').textContent=text;}
  async function organize(){
    if(organizing||testingApi)return;
    const id=currentId();if(!id)return;
    organizing=id;organizationAbort=new AbortController();const signal=organizationAbort.signal;
    $('organize').disabled=true;settingsButton.disabled=true;$('pause-organize').hidden=false;
    try{
      await settingsReady;const config=apiConfig(organizerConfig);
      organizationStatus('正在读取待整理资料…');
      await sync(true);
      while(pending===id){signal.throwIfAborted();await new Promise(resolve=>setTimeout(resolve,250));}
      if(!data?.messages.length||data.threadId!==id||currentId()!==id)throw Error('当前对话尚未读取完成,请稍后重试');
      await hydrateAnnotations(id);
      const snapshot=data,old=storedAnnotations(id);
      const record=recordCache.get(id)||{published:old.nodes.length?old:null};
      const applyGraph=result=>{annotationCache.set(id,result);if(!disposed&&active===id){data={...data,...buildGraph(data.messages,result)};selected=null;$('details').hidden=true;render();status(`已同步${nativeReadTasks.has(id)?'(原生分页)':''} · ${result.nodes.length} 个任务节点`);}};
      const showProgress=text=>{if(active!==id)return;const job=recordCache.get(id)?.job;const repair=job?.pending?.repair;organizationStatus(`${job?.kind==='rebuild'?'重整中,当前展示上次结果 · ':''}${repair?`补正 ${repair.attempt}/2 · `:''}${text}`);};
      const saved=await organizeLong({messages:snapshot.messages,record,signal,compact:config.channel==='external',
        save:async document=>{await canvasStore(`tree:${id}`,document);recordCache.set(id,document);},
        progress:showProgress,onGraph:applyGraph,
        run:(prompt,requestId,session,onSession)=>config.channel==='external'
          ?externalOrganizer.run(config,prompt,requestId,session,onSession,signal,text=>showProgress(`第 ${(recordCache.get(id)?.job?.state?.batchCount||0)+1} 批 · ${text}`))
          :nativeSideChat(id,prompt,text=>showProgress(`第 ${(recordCache.get(id)?.job?.state?.batchCount||0)+1} 批 · ${text}`),signal,{session,onSession,requestId})});
      if(!disposed&&active===id)organizationStatus(`整理完成 · ${saved.published.nodes.length} 个任务节点,进度已保存;新增消息可增量整理`);
    }catch(error){if(!disposed&&active===id)organizationStatus(error.name==='AbortError'?'已暂停,已完成批次保留。后台模型可能仍在运行,点击继续可接收结果。':`整理暂未完成:${error.message}。已完成批次保留,点击继续重试。`);}
    finally{organizing=null;if(!disposed){$('organize').disabled=false;settingsButton.disabled=false;$('organize').textContent=recordCache.get(active)?.job?'继续整理':'增量整理';$('pause-organize').hidden=true;}}
  }
  function currentId(){
    const route=(location.href.match(uuid)||[])[0];if(route)return route;
    const rows=[...document.querySelectorAll('[data-app-action-sidebar-thread-id]')].filter(row=>['page','true'].includes(row.getAttribute('aria-current'))||row.querySelector('[aria-current="page"],[aria-current="true"]'));

View on GitHub (pinned to b1ed92e5e4)