Kong/insomnia · error · Error

failed to unparse cookie, the cookie options seems invalid

Error message

failed to unparse cookie, the cookie options seems invalid

What it means

Error "failed to unparse cookie, the cookie options seems invalid" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia-scripting-environment/src/objects/cookies.ts:128

      maxAge: cookieObj.maxAge,
      domain: cookieObj.domain || undefined,
      path: cookieObj.path || undefined,
      secure: cookieObj.secure || false,
      httpOnly: cookieObj.httpOnly || false,
      hostOnly,
      session,
      extensions: extensions,
    };
  }

  static stringify(cookie: Cookie) {
    return cookie.toString();
  }

  static unparseSingle(cookieOpt: CookieOptions) {
    const cookie = new Cookie(cookieOpt);
    if (!cookie) {
      throw new Error('failed to unparse cookie, the cookie options seems invalid');
    }
    return cookie.toString();
  }

  static unparse(cookies: Cookie[]) {
    const cookieStrs = cookies.map(cookie => cookie.toString());
    return cookieStrs.join('; ');
  }

  override toString = () => {
    const hostOnlyPart = this.cookie.hostOnly ? '; HostOnly' : '';
    const sessionPart = this.cookie.extensions?.includes('session') ? '; Session' : '';
    const extensionPart =
      this.extensions && this.extensions.length > 0
        ? '; ' + this.extensions.map(ext => `${ext.key}=${ext.value}`).join(';')
        : '';

    return this.cookie.toString() + hostOnlyPart + sessionPart + extensionPart;

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia-scripting-environment/src/objects/cookies.ts:128 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/6dd91d62ab2801a0. Report an issue: GitHub.