{"record":{"id":"2aec5a0a07f1723e","repo":"jackwener/OpenCLI","slug":"not-a-valid-yuanbao-session-reference-got-inpu","errorCode":null,"errorMessage":"not a valid Yuanbao session reference (got \"${input}\"); pass either a full https://yuanbao.tencent.com/chat/<agentId>/<convId> URL or a bare \"<agentId>/<convId>\" pair. A UUID alone is not enough — Yuanbao requires the agentId.","messagePattern":"not a valid Yuanbao session reference \\(got \"(.+?)\"\\); pass either a full https://yuanbao\\.tencent\\.com/chat/<agentId>/<convId> URL or a bare \"<agentId>/<convId>\" pair\\. A UUID alone is not enough — Yuanbao requires the agentId\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/yuanbao/shared.js","lineNumber":114,"sourceCode":"            throw new ArgumentError(\n                'id',\n                `not a valid Yuanbao chat URL (got \"${input}\"); expected https://yuanbao.tencent.com/chat/<agentId>/<convId>`,\n            );\n        }\n        return { agentId, convId: convId.toLowerCase() };\n    }\n    const slashMatch = raw.match(/^([A-Za-z0-9_-]+)\\/([0-9a-f-]{36})$/i);\n    if (slashMatch) {\n        const [, agentId, convId] = slashMatch;\n        if (!AGENT_ID_RE.test(agentId) || !CONV_ID_RE.test(convId)) {\n            throw new ArgumentError(\n                'id',\n                `not a valid Yuanbao \"<agentId>/<convId>\" pair (got \"${input}\"); agentId must be 4-40 word chars, convId must be a UUID`,\n            );\n        }\n        return { agentId, convId: convId.toLowerCase() };\n    }\n    throw new ArgumentError(\n        'id',\n        `not a valid Yuanbao session reference (got \"${input}\"); pass either a full https://yuanbao.tencent.com/chat/<agentId>/<convId> URL or a bare \"<agentId>/<convId>\" pair. A UUID alone is not enough — Yuanbao requires the agentId.`,\n    );\n}\n\nexport async function getCurrentYuanbaoSessionId(page) {\n    const url = await page.evaluate('window.location.href').catch(() => '');\n    if (typeof url !== 'string') return null;\n    const match = url.match(/yuanbao\\.tencent\\.com\\/chat\\/([A-Za-z0-9_-]+)\\/([0-9a-f-]{36})(?:[/?#]|$)/i);\n    if (!match) return null;\n    const [, agentId, convId] = match;\n    if (!AGENT_ID_RE.test(agentId) || !CONV_ID_RE.test(convId)) return null;\n    return { agentId, convId: convId.toLowerCase() };\n}\n\nexport async function getYuanbaoModelLabel(page) {\n    const result = await page.evaluate(`(() => {\n    const btn = document.querySelector('[dt-button-id=\"model_switch\"]');","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yuanbao/shared.js#L96-L132","documentation":"This is the fallback rejection in parseYuanbaoSessionId: the input was neither a Yuanbao chat URL nor an <agentId>/<convId> pair. The message explicitly calls out the most common mistaken form — a bare conversation UUID — since Yuanbao requires the agentId alongside it.","triggerScenarios":"Passing a lone UUID ('9f8b7c6d-...'), a URL without the /chat/ path, a session title from `yuanbao history` instead of its AgentId/SessionId, or input with spaces/typos such as a trailing slash-separated pair with wrong segment count.","commonSituations":"Assuming convId alone identifies a conversation (it does not — agentId is mandatory); copying the Title column from history output; older scripts built for a CLI version that accepted UUID-only references.","solutions":["Pass the full URL: https://yuanbao.tencent.com/chat/<agentId>/<convId>","Or the pair: `<agentId>/<convId>` — both parts are required","Get AgentId/SessionId from `yuanbao history` (columns Index, Title, AgentId, SessionId, Url) and use those, never the Title","If you only have a UUID, list conversations and match it against the SessionId column to recover the agentId"],"exampleFix":"// before\nawait cli.open('9f8b7c6d-1234-4a5b-8c9d-0e1f2a3b4c5d');\n// after\nawait cli.open('tencent-agent/9f8b7c6d-1234-4a5b-8c9d-0e1f2a3b4c5d');","handlingStrategy":"validation","validationCode":"const isUrl = /yuanbao\\.tencent\\.com\\/chat\\//i.test(input);\nconst isPair = /^[A-Za-z0-9_-]+\\/[0-9a-f-]{36}$/i.test(input);\nif (!isUrl && !isPair) throw new Error('need a chat URL or <agentId>/<convId> pair; a bare UUID is not enough');","typeGuard":"const isUsableSessionRef = (v) => typeof v === 'string' && (\n  /yuanbao\\.tencent\\.com\\/chat\\//i.test(v) || /^[A-Za-z0-9_-]+\\/[0-9a-f-]{36}$/i.test(v.trim())\n);","tryCatchPattern":"try {\n  await cli.yuanbaoOpen(input);\n} catch (e) {\n  if (e.name === 'ArgumentError' && /not a valid Yuanbao session reference/.test(e.message)) {\n    const sessions = await cli.yuanbaoHistory({ limit: 50 });\n    const hit = sessions.find(s => s.SessionId?.startsWith(uuidFragment));\n    if (hit) await cli.yuanbaoOpen(`${hit.AgentId}/${hit.SessionId}`);\n  } else throw e;\n}","preventionTips":["Never pass a bare conversation UUID — agentId is mandatory","Never pass the Title column from history output; use AgentId/SessionId or Url","Normalize all stored references to the full chat URL format"],"tags":["validation","argument-error","session-id"],"backgroundTag":"invalid-session-reference","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}