Kong/insomnia · error

Unable to read cookie: ${cookie}

Error message

Unable to read cookie: ${cookie}

What it means

Error "Unable to read cookie: ${cookie}" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia/src/common/cookies.ts:55

    jar = CookieJar.fromJSON(copy);
  } catch (error) {
    console.log('[cookies] Failed to initialize cookie jar', error);
    jar = new CookieJar() as CookieJar;
  }

  jar.rejectPublicSuffixes = false;
  jar.looseMode = true;

  return jar;
};

export const cookieToString = (cookie: Parameters<typeof ToughCookie.fromJSON>[0] | ToughCookie) => {
  // Cookie can either be a plain JS object or Cookie instance
  if (!(cookie instanceof ToughCookie)) {
    cookie = ToughCookie.fromJSON(cookie) as ToughCookie;

    if (cookie === null) {
      throw new Error(`Unable to read cookie: ${cookie}`);
    }
  }
  let str = cookie.toString();

  // tough-cookie toString() doesn't put domain on all the time.
  // This hack adds when tough-cookie won't
  if ((cookie as ToughCookie).domain && (cookie as ToughCookie).hostOnly) {
    str += `; Domain=${(cookie as ToughCookie).domain}`;
  }

  return str;
};

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia/src/common/cookies.ts:55 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/f3814a2bd086dc30. Report an issue: GitHub.