{"record":{"id":"3517976b15cafb6b","repo":"garrytan/gstack","slug":"no-decryption-key-available-for-prefix-cookies","errorCode":null,"errorMessage":"No decryption key available for ${prefix} cookies","messagePattern":"No decryption key available for (.+?) cookies","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/cookie-import-browser.ts","lineNumber":692,"sourceCode":"\nfunction decryptCookieValue(row: RawCookie, keys: Map<string, Buffer>, platform: BrowserPlatform): string {\n  // Prefer unencrypted value if present\n  if (row.value && row.value.length > 0) return row.value;\n\n  const ev = Buffer.from(row.encrypted_value);\n  if (ev.length === 0) return '';\n\n  const prefix = ev.slice(0, 3).toString('utf-8');\n\n  // Chrome 127+ on Windows uses App-Bound Encryption (v20) — cannot be decrypted\n  // outside the Chrome process. Caller should fall back to CDP extraction.\n  if (prefix === 'v20') throw new CookieImportError(\n    'Cookie uses App-Bound Encryption (v20). Use CDP extraction instead.',\n    'v20_encryption',\n  );\n\n  const key = keys.get(prefix);\n  if (!key) throw new Error(`No decryption key available for ${prefix} cookies`);\n\n  if (platform === 'win32' && prefix === 'v10') {\n    // Windows: AES-256-GCM — structure: v10(3) + nonce(12) + ciphertext + tag(16)\n    const nonce = ev.slice(3, 15);\n    const tag = ev.slice(ev.length - 16);\n    const ciphertext = ev.slice(15, ev.length - 16);\n    const decipher = crypto.createDecipheriv('aes-256-gcm', key, nonce) as crypto.DecipherGCM;\n    decipher.setAuthTag(tag);\n    return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('utf-8');\n  }\n\n  // macOS / Linux: AES-128-CBC — structure: v10/v11(3) + ciphertext\n  const ciphertext = ev.slice(3);\n  const iv = Buffer.alloc(16, 0x20); // 16 space characters\n  const decipher = crypto.createDecipheriv('aes-128-cbc', key, iv);\n  const plaintext = Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n\n  // Chromium prefixes encrypted cookie payloads with 32 bytes of metadata.","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/cookie-import-browser.ts#L674-L710","documentation":"Error \"No decryption key available for ${prefix} cookies\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/cookie-import-browser.ts:692 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}