{"record":{"id":"f3814a2bd086dc30","repo":"Kong/insomnia","slug":"unable-to-read-cookie-cookie","errorCode":null,"errorMessage":"Unable to read cookie: ${cookie}","messagePattern":"Unable to read cookie: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/common/cookies.ts","lineNumber":55,"sourceCode":"    jar = CookieJar.fromJSON(copy);\n  } catch (error) {\n    console.log('[cookies] Failed to initialize cookie jar', error);\n    jar = new CookieJar() as CookieJar;\n  }\n\n  jar.rejectPublicSuffixes = false;\n  jar.looseMode = true;\n\n  return jar;\n};\n\nexport const cookieToString = (cookie: Parameters<typeof ToughCookie.fromJSON>[0] | ToughCookie) => {\n  // Cookie can either be a plain JS object or Cookie instance\n  if (!(cookie instanceof ToughCookie)) {\n    cookie = ToughCookie.fromJSON(cookie) as ToughCookie;\n\n    if (cookie === null) {\n      throw new Error(`Unable to read cookie: ${cookie}`);\n    }\n  }\n  let str = cookie.toString();\n\n  // tough-cookie toString() doesn't put domain on all the time.\n  // This hack adds when tough-cookie won't\n  if ((cookie as ToughCookie).domain && (cookie as ToughCookie).hostOnly) {\n    str += `; Domain=${(cookie as ToughCookie).domain}`;\n  }\n\n  return str;\n};\n","sourceCodeStart":37,"sourceCodeEnd":68,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/common/cookies.ts#L37-L68","documentation":"Error \"Unable to read cookie: ${cookie}\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia/src/common/cookies.ts:55 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":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}