jackwener/OpenCLI · error · ArgumentError
not a valid Yuanbao chat URL (got "${input}"); expected http
Error message
not a valid Yuanbao chat URL (got "${input}"); expected https://yuanbao.tencent.com/chat/<agentId>/<convId> What it means
The input matched the Yuanbao chat URL shape but the extracted agentId or convId failed the stricter AGENT_ID_RE (4-40 word chars) or CONV_ID_RE (canonical UUID) checks. This guards against lookalike URLs whose captured segments would produce unusable ids downstream.
Source
Thrown at clis/yuanbao/shared.js:96
* A bare convId UUID is rejected with an actionable message — opening the
* wrong agent silently is a much worse failure mode than throwing.
*
* The trailing `(?:[/?#]|$)` boundary in the URL regex prevents over-long
* suffixes (e.g. `<id>extra`) from silently truncating to a valid-looking ID.
*/
export function parseYuanbaoSessionId(input) {
const raw = String(input ?? '').trim();
if (!raw) {
throw new ArgumentError(
'id',
'must be a non-empty Yuanbao chat URL or "<agentId>/<convId>" pair',
);
}
const urlMatch = raw.match(/yuanbao\.tencent\.com\/chat\/([A-Za-z0-9_-]+)\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[/?#]|$)/i);
if (urlMatch) {
const [, agentId, convId] = urlMatch;
if (!AGENT_ID_RE.test(agentId) || !CONV_ID_RE.test(convId)) {
throw new ArgumentError(
'id',
`not a valid Yuanbao chat URL (got "${input}"); expected https://yuanbao.tencent.com/chat/<agentId>/<convId>`,
);
}
return { agentId, convId: convId.toLowerCase() };
}
const slashMatch = raw.match(/^([A-Za-z0-9_-]+)\/([0-9a-f-]{36})$/i);
if (slashMatch) {
const [, agentId, convId] = slashMatch;
if (!AGENT_ID_RE.test(agentId) || !CONV_ID_RE.test(convId)) {
throw new ArgumentError(
'id',
`not a valid Yuanbao "<agentId>/<convId>" pair (got "${input}"); agentId must be 4-40 word chars, convId must be a UUID`,
);
}
return { agentId, convId: convId.toLowerCase() };
}
throw new ArgumentError(View on GitHub (pinned to 49907e53dc)
Solutions
- Copy the chat URL directly from the browser address bar rather than editing it by hand
- Verify agentId is 4-40 chars of [A-Za-z0-9_-] and convId is a standard UUID
- Fetch a fresh, known-good reference via `yuanbao history` and use its AgentId/SessionId
- If your id is a legacy format, obtain a new conversation link from the Yuanbao UI
Example fix
// before
await cli.open('https://yuanbao.tencent.com/chat/ab/12345');
// after
await cli.open('https://yuanbao.tencent.com/chat/tencent-yuanbao-agent/9f8b7c6d-1234-4a5b-8c9d-0e1f2a3b4c5d'); Defensive patterns
Strategy: validation
Validate before calling
const AGENT_RE = /^[A-Za-z0-9_-]{4,40}$/;
const CONV_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
const m = url.match(/yuanbao\.tencent\.com\/chat\/([^/?#]+)\/([^/?#]+)/i);
if (!m || !AGENT_RE.test(m[1]) || !CONV_RE.test(m[2])) throw new Error('invalid Yuanbao chat URL'); Type guard
const isValidYuanbaoUrl = (v) => {
if (typeof v !== 'string') return false;
const m = v.match(/yuanbao\.tencent\.com\/chat\/([A-Za-z0-9_-]+)\/([0-9a-f-]{36})(?:[/?#]|$)/i);
return !!m && /^[A-Za-z0-9_-]{4,40}$/.test(m[1]);
}; Try / catch
try {
await cli.yuanbaoOpen(url);
} catch (e) {
if (e.name === 'ArgumentError' && /not a valid Yuanbao chat URL/.test(e.message)) {
console.error('Re-copy the URL from the browser address bar');
} else throw e;
} Prevention
- Copy URLs verbatim from the browser address bar; never hand-edit ids
- Validate agentId (4-40 word chars) and convId (canonical UUID) at ingestion time
- Regenerate references if Yuanbao changed URL formats
When it happens
Trigger: Passing a URL where the agent segment contains disallowed characters (e.g. dots, non-ASCII, CJK) or is shorter than 4 / longer than 40 chars, or where the conversation segment is a malformed UUID (wrong length, invalid hex, extra dashes).
Common situations: Hand-edited or truncated URLs copied from logs; localized Yuanbao URLs with encoded agent ids; IDs from an older Yuanbao URL scheme that no longer match the current format; typos when constructing the URL programmatically.
Related errors
- '${rawInput}' does not look like an autohome series id (a nu
- bilibili follow target must be a valid space.bilibili.com/<u
- chatgpt project commands require a chatgpt.com project id or
- Invalid Chess.com game URL: "${value}" Expected https://www.
- id must be a non-empty session ID or grok.com chat URL
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/babeb685a5dcd316.
Report an issue: GitHub.