{"record":{"id":"25a84c59e5952af8","repo":"schollz/croc","slug":"peer-uses-unsupported-pake-protocol-version-vers","errorCode":null,"errorMessage":"Peer uses unsupported PAKE protocol version ${version ?? 0}; upgrade both croc clients","messagePattern":"Peer uses unsupported PAKE protocol version (.+?); upgrade both croc clients","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/protocol/client.ts","lineNumber":56,"sourceCode":"const PAKE_PURPOSE_LOCAL_PROBE = \"local-ip-probe\";\n\ntype RelayConnection = {\n  socket: CrocSocket;\n  banner: string;\n  externalIP: string;\n};\n\nfunction abortError() {\n  return new DOMException(\"Transfer cancelled\", \"AbortError\");\n}\n\nfunction checkAbort(signal?: AbortSignal) {\n  if (signal?.aborted) throw abortError();\n}\n\nfunction requirePakeVersion(version: number | undefined) {\n  if (version !== PAKE_PROTOCOL_VERSION) {\n    throw new Error(\n      `Peer uses unsupported PAKE protocol version ${version ?? 0}; upgrade both croc clients`,\n    );\n  }\n}\n\nfunction validateSecret(secret: string) {\n  if (secret.length < 6) throw new Error(\"Code must be at least 6 characters\");\n  if (!/^[\\x20-\\x7e]+$/.test(secret)) {\n    throw new Error(\"Custom codes must use printable ASCII characters\");\n  }\n}\n\nfunction controlPort(relayAddress: string) {\n  try {\n    const parsed = new URL(\n      relayAddress.includes(\"://\") ? relayAddress : `tcp://${relayAddress}`,\n    );\n    return parsed.port || CONTROL_PORT;","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/schollz/croc/blob/e25f1bdc04f07f094d50b0a1bf67e2563944b57a/web/src/protocol/client.ts#L38-L74","documentation":"During a PAKE handshake the peer advertised a protocol version other than PAKE_PROTOCOL_VERSION (currently 2), or omitted it (reported as 0). The client refuses to continue because the derived keys and message framing would not be compatible. This is an intentional hard incompatibility check between croc client versions.","triggerScenarios":"requirePakeVersion runs on the peer's first control message (probe.Kind === 'pake1' with a Version field) and on 'pake'/'pake-confirm' messages; a peer running croc v9 (v1 PAKE) or a newer v3 protocol triggers it. Mixed CLI and web client versions on the two ends are the usual source.","commonSituations":"One side has an outdated croc installation; a fork or custom build that changed the version constant; the web wasm bundle built from a different commit than the peer's client.","solutions":["Upgrade the croc client on BOTH ends so both negotiate version 2","If you control both builds, align PAKE_PROTOCOL_VERSION in client.ts with the Go implementation and rebuild","Verify the web bundle's croc.wasm matches the released croc version you are pairing with"],"exampleFix":"// before: mixed versions\n// sender: croc v9.6.6 (PAKE v1)  ->  recipient: this web client (PAKE v2)\n// Error: Peer uses unsupported PAKE protocol version 1\n\n// after\n$ croc upgrade   # or reinstall both ends at the same release\n# retry the transfer with matching clients","handlingStrategy":"try-catch","validationCode":"// Before connecting, verify the local PAKE version is the one you ship\nimport { PAKE_VERSION } from \"../protocol/version\";\nif (PAKE_VERSION !== 2) throw new Error(\"This build speaks an unsupported PAKE version\");","typeGuard":"function isPakeV2(msg) {\n  return msg && typeof msg === \"object\" && msg.v === 2;\n}","tryCatchPattern":"try {\n  await sendFiles(opts);\n} catch (e) {\n  if (/unsupported PAKE protocol version/.test(e.message)) {\n    showBanner(\"The other side runs a different croc version. Upgrade both and retry.\");\n    return;\n  }\n  throw e;\n}","preventionTips":["Pin both ends to the same croc release for a transfer session","Surface this error as an upgrade prompt in the UI, not a generic failure","In CI, assert the JS constant and Go constant for PAKE version stay in sync"],"tags":["pake","version-mismatch","compatibility","handshake"],"backgroundTag":null,"analyzedSha":"e25f1bdc04f07f094d50b0a1bf67e2563944b57a","analyzedAt":"2026-08-15T12:53:39.096Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}