{"record":{"id":"2d4db4335a74def2","repo":"diegosouzapw/OmniRoute","slug":"invalid-cookie-json-at-index-i-missing-require-2d4db4","errorCode":null,"errorMessage":"Invalid cookie JSON at index ${i}: missing required field 'value'","messagePattern":"Invalid cookie JSON at index (.+?): missing required field 'value'","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/providers/webCookieAuth.ts","lineNumber":54,"sourceCode":"    return null;\n  }\n\n  if (!Array.isArray(parsed)) return null;\n  if (parsed.length === 0) return \"\";\n\n  const parts: string[] = [];\n  for (let i = 0; i < parsed.length; i++) {\n    const entry = parsed[i];\n    if (!entry || typeof entry !== \"object\" || Array.isArray(entry)) {\n      throw new Error(`Invalid cookie JSON at index ${i}: expected an object`);\n    }\n    const record = entry as Record<string, unknown>;\n\n    if (typeof record.name !== \"string\" || !record.name) {\n      throw new Error(`Invalid cookie JSON at index ${i}: missing required field 'name'`);\n    }\n    if (typeof record.value !== \"string\") {\n      throw new Error(`Invalid cookie JSON at index ${i}: missing required field 'value'`);\n    }\n\n    parts.push(`${record.name}=${record.value}`);\n  }\n\n  return parts.join(\"; \");\n}\n\nexport function normalizeSessionCookieHeader(rawValue: string, defaultCookieName: string): string {\n  const stripped = stripCookieInputPrefix(rawValue);\n  if (!stripped) return \"\";\n\n  const jsonResult = parseJsonCookiesToHeader(stripped);\n  if (jsonResult !== null) {\n    return jsonResult;\n  }\n\n  if (stripped.includes(\"=\")) {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/providers/webCookieAuth.ts#L36-L72","documentation":"Validation guard in parseJsonCookiesToHeader(): the cookie array element at the given index has a 'name' but its 'value' field is not a string (missing, null, or a number/boolean/object). Every entry must have a string value to build the Cookie header.","triggerScenarios":"Thrown at src/lib/providers/webCookieAuth.ts:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set a string 'value' field on the cookie entry at the reported index.","If the value was exported as a non-string JSON type, convert it to a string before saving.","Re-export cookies from the browser in the documented [{name, value}] JSON format."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}