BigPizzaV3/CodexPlusPlus · error · Error

当前推进节点不存在

Error message

当前推进节点不存在

What it means

validateOrganization throws this when the result's `currentNodeId` (or the provided `currentNodeId` field) is non-null but does not match any node ID in the validated tree. The 'current' pointer must always point at an existing node.

Solutions

  1. Set currentNodeId to an ID present in the nodes array
  2. Set currentNodeId to null if there is no current node
  3. Re-run the organize request reminding the model that currentNodeId must reference an existing node
  4. Verify the ID spelling matches a node id exactly

Example fix

// before
"currentNodeId":"n-future"  // not in nodes
// after
"currentNodeId":"n2"  // existing node
Defensive patterns

Strategy: validation

Validate before calling

if (value.currentNodeId != null && !value.nodes.some(n => n.id === value.currentNodeId)) console.warn('currentNodeId missing from nodes');

Type guard

function currentNodeExists(value) { return value?.currentNodeId == null || value.nodes?.some(n => n.id === value.currentNodeId); }

Try / catch

try { org = parseOrganization(text, messages, requestId); } catch (e) { if (e.message.includes('当前推进节点不存在')) { value.currentNodeId = null; org = parseOrganization(JSON.stringify(value), messages, requestId); } else throw e; }

Prevention

When it happens

Trigger: The model sets `currentNodeId` to an ID it did not include in `nodes`, or omits a node that the current pointer references, during parseOrganization.

Common situations: The model advances the current node to a planned-but-not-yet-created node, or renames IDs while forgetting to update currentNodeId.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

    for(const key of ['title','summary','description','status'])if(typeof n[key]!=='string'||!n[key].trim()||n[key].length>12000)throw Error('整理结果缺少节点描述');
    if(n.parent!==null&&typeof n.parent!=='string')throw Error('整理结果父节点无效');
    ids.add(n.id);nodes.push({id:n.id,parent:n.parent,lane:n.lane,title:n.title,summary:n.summary,description:n.description,status:n.status,sources:[...new Set(n.sources)]});
  }
  const roots=nodes.filter(n=>n.parent===null),byId=new Map(nodes.map(n=>[n.id,n]));
  if(roots.length!==1||roots[0].lane!=='main')throw Error('任务树必须有且只有一个主目标根节点');
  const checked=new Set();
  for(const node of nodes){
    const path=new Set();let current=node;
    while(current&&!checked.has(current.id)){
      if(path.has(current.id))throw Error('任务树存在循环关联');
      path.add(current.id);
      if(current.parent!==null&&!byId.has(current.parent))throw Error('任务树包含不存在的父节点');
      current=current.parent===null?null:byId.get(current.parent);
    }
    for(const id of path)checked.add(id);
  }
  const currentNodeId=value.currentNodeId??null;
  if(currentNodeId!==null&&!byId.has(currentNodeId))throw Error('当前推进节点不存在');
  return {schemaVersion:2,currentNodeId,nodes};
}

function parseOrganization(text,messages,requestId) {
  const blocks=[...text.matchAll(/```(?:json)?\s*([\s\S]*?)```/g)].map(m=>m[1]);
  for(const raw of [...blocks,text.trim()]){
    let value;try{value=JSON.parse(raw);}catch{continue;}
    if(value?.requestId===requestId)return validateOrganization(value,messages,requestId);
  }
  throw Error('侧边对话未返回可识别的整理结果');
}


const messageHashes=new WeakMap();
async function messageDigest(message){
  const cached=messageHashes.get(message);
  if(cached?.text===message.text)return cached.digest;
  const bytes=new TextEncoder().encode(`${message.role}\n${message.phase||''}\n${message.text}`);

View on GitHub (pinned to b1ed92e5e4)