{"record":{"id":"5fc53633bbc545c8","repo":"Kong/insomnia","slug":"failed-to-decode-base64","errorCode":null,"errorMessage":"Failed to decode base64","messagePattern":"Failed to decode base64","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/ui/auth-session-provider.client.ts","lineNumber":40,"sourceCode":"  } catch {\n    console.error('Failed to store secret key in localStorage.');\n  }\n});\n/**\n * Keypair used for the login handshake.\n * This keypair can be re-used for the entire session.\n */\n\nexport async function decodeBase64(base64: string): Promise<Uint8Array> {\n  try {\n    let uri = 'data:application/octet-binary;base64,';\n    uri += base64;\n    const res = await fetch(uri);\n    const buffer = await res.arrayBuffer();\n    return new Uint8Array(buffer);\n  } catch (error) {\n    console.error(error);\n    throw new Error('Failed to decode base64');\n  }\n}\n\nexport async function encodeBase64(data: Uint8Array): Promise<string> {\n  const dataUri = await new Promise<string>((resolve, reject) => {\n    const reader = new FileReader();\n    reader.onload = () => {\n      if (typeof reader.result === 'string') {\n        resolve(reader.result);\n      } else {\n        reject();\n      }\n    };\n    reader.onerror = reject;\n    reader.readAsDataURL(new Blob([data]));\n  });\n\n  const dataAt = dataUri.indexOf(',');","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/ui/auth-session-provider.client.ts#L22-L58","documentation":"Sentinel from decodeBase64 in the auth session provider: the data-URI fetch trick used to decode a base64 string (login handshake key material) failed, so the raw cause is masked by this generic message.","triggerScenarios":"Thrown at packages/insomnia/src/ui/auth-session-provider.client.ts:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the base64 input is well-formed and complete (no truncation or whitespace)","Regenerate the session keypair by logging in again if key material is corrupt"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","contentChangedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}