{"record":{"id":"f03128cfdcd5b372","repo":"can1357/oh-my-pi","slug":"invalid-qwencloud-cookie-header-copy-the-complete","errorCode":null,"errorMessage":"Invalid QwenCloud Cookie header. Copy the complete Cookie request header from the ${cookieRequestHost} usage request, not a single cookie value.","messagePattern":"Invalid QwenCloud Cookie header\\. Copy the complete Cookie request header from the (.+?) usage request, not a single cookie value\\.","errorType":"exception","errorClass":"AIError.ConfigurationError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/registry/alibaba-token-plan.ts","lineNumber":113,"sourceCode":"\t\t\t\t: \"Optional quota reporting: open browser DevTools → Network, reload the Token Plan page, filter for api.json, and select the cs-data.qwencloud.com/data/api.json request whose api query ends in /tokenplan/personal/api/v2/usage. Copy Request Headers → Cookie, then paste the complete name=value; ... value here, or press Enter to skip.\",\n\t\tplaceholder: \"name=value; name=value; ...\",\n\t\tallowEmpty: true,\n\t});\n\tconst cookie = rawCookie\n\t\t.trim()\n\t\t.replace(/^Cookie:\\s*/i, \"\")\n\t\t.trim();\n\tif (options.signal?.aborted) {\n\t\tthrow new AIError.LoginCancelledError();\n\t}\n\tif (\n\t\tcookie &&\n\t\t!cookie.split(\";\").some(segment => {\n\t\t\tconst separator = segment.indexOf(\"=\");\n\t\t\treturn separator > 0 && Boolean(segment.slice(0, separator).trim() && segment.slice(separator + 1).trim());\n\t\t})\n\t) {\n\t\tthrow new AIError.ConfigurationError(\n\t\t\t`Invalid QwenCloud Cookie header. Copy the complete Cookie request header from the ${cookieRequestHost} usage request, not a single cookie value.`,\n\t\t);\n\t}\n\n\t// International (default) logins keep their existing bare/cookie credential\n\t// form; only a diverging region is persisted so it can override the catalog\n\t// base URL at inference and discovery time.\n\tconst regionUrl = baseUrl === ALIBABA_TOKEN_PLAN_BASE_URL ? undefined : baseUrl;\n\treturn serializeAlibabaTokenPlanCredential(apiKey, cookie, regionUrl);\n}\n\nexport const alibabaTokenPlanProvider = {\n\tid: \"alibaba-token-plan\",\n\tname: \"QwenCloud Token Plan\",\n\tlogin: (cb: OAuthLoginCallbacks) => loginAlibabaTokenPlan(cb),\n} as const satisfies ProviderDefinition;\n","sourceCodeStart":95,"sourceCodeEnd":130,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/ai/src/registry/alibaba-token-plan.ts#L95-L130","documentation":"QwenCloud login can accept a full Cookie request header (multiple `name=value` segments separated by `;`). The login validates each semicolon-separated segment has a non-empty key and value; if the pasted value has no valid `key=value` segment, ConfigurationError is thrown telling the user to copy the complete Cookie header from the cookieRequestHost usage request rather than a single cookie value.","triggerScenarios":"Pasting a single cookie value (e.g. just the token string, or one `name=value` with empty name/value, no `=` at all) when the login flow expects the entire multi-pair Cookie header captured from the browser devtools request.","commonSituations":"Copying only one cookie from devtools Application tab instead of the request header; header truncated by terminal line wrapping; pasting a bearer token into the cookie prompt; expired/reformatted cookie copied from the wrong request.","solutions":["Open browser devtools Network tab, find the usage request to the stated host, and copy the complete `Cookie:` request header value","Ensure the copied string contains at least one valid `name=value` pair separated by semicolons","Avoid copying from the Application/Storage cookie list; use the raw request header","If you only have an API-key style credential, check whether the flow supports a bare-key form instead"],"exampleFix":"// before (single value, rejected)\ntokenXyz123\n// after (complete header)\nlogin_tk=abc123; cna=xyz; t=456; sessionId=789","handlingStrategy":"validation","validationCode":"function isCookieHeader(v) { return typeof v === 'string' && v.split(';').some(s => { const i = s.indexOf('='); return i > 0 && s.slice(0,i).trim() && s.slice(i+1).trim(); }); }\nif (!isCookieHeader(pastedValue)) throw new Error('Paste the complete Cookie request header (name=value; ...), not a single cookie');","typeGuard":"function isCookieHeader(v: unknown): v is string { return typeof v === 'string' && v.split(';').some(seg => { const i = seg.indexOf('='); return i > 0 && Boolean(seg.slice(0, i).trim() && seg.slice(i + 1).trim()); }); }","tryCatchPattern":"try { key = await loginAlibabaTokenPlan(controller); } catch (e) { if (e instanceof AIError.ConfigurationError && String(e.message).includes('Cookie header')) console.error('Recopy the full Cookie request header from the Network tab.'); else throw e; }","preventionTips":["Copy from the Network tab request header, not the cookie storage list","Verify the paste contains at least one name=value pair before submitting","Watch for terminal wrapping truncating long headers","Use the bare API-key form when no browser session exists"],"tags":["authentication","cookies","configuration"],"backgroundTag":"invalid-credential-format","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}