Kong/insomnia · error

Unable to read cookie

Error message

Unable to read cookie: ${cookie}

What it means

Guard in the cookie IPC handler's cookieToString: converting the renderer-supplied cookie (string or object) via ToughCookie.fromJSON returned null, so it is not a valid cookie serialization. The unparseable value is interpolated before the handler rejects it.

Solutions

  1. Inspect and fix the cookie entry in the cookie jar data
  2. Delete the malformed cookie and re-add it via the UI
  3. Validate cookie JSON shape (key, value, domain, path)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/insomnia/src/main/ipc/cookies.ts:30 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26). Data as JSON: /api/errors/8ba5113f77bd346f. Report an issue: GitHub.

Appendix: source

Thrown at packages/insomnia/src/main/ipc/cookies.ts:30

  setCookieStrings: string[];
  currentUrl: string;
  cookieJar: Cookie[];
}

interface AddSetCookiesResult {
  cookies: Cookie[];
  rejectedCookies: string[];
}

const parseCookieFromJSON = (cookie: CookieInput) => {
  return typeof cookie === 'string' ? ToughCookie.fromJSON(cookie) : ToughCookie.fromJSON(cookie);
};

const cookieToString = (cookie: CookieInput) => {
  const parsedCookie = parseCookieFromJSON(cookie);

  if (parsedCookie === null) {
    throw new Error(`Unable to read cookie: ${cookie}`);
  }

  let value = parsedCookie.toString();

  if (parsedCookie.domain && parsedCookie.hostOnly) {
    value += `; Domain=${parsedCookie.domain}`;
  }

  return value;
};

const getCookiesForUrl = (cookies: Cookie[], url: string): Cookie[] => {
  try {
    const sanitized = cookies.map(c => ({
      ...c,
      expires: c.expires === null || c.expires === undefined ? 'Infinity' : c.expires,
    }));
    const jar = CookieJar.fromJSON(JSON.stringify({ cookies: sanitized }));

View on GitHub (pinned to d9bb2b0142)