{"record":{"id":"c96fbd9adfba5a2f","repo":"hcengineering/platform","slug":"unknown-method-method-c96fbd","errorCode":null,"errorMessage":"Unknown method${method}","messagePattern":"Unknown method(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/net/packages/server/src/server.ts","lineNumber":120,"sourceCode":"        await this.network.release(client, uuid)\n        await send('ok')\n        break\n      }\n      case opNames.listContainers: {\n        const kind: ContainerKind = params.kind\n        await send(await this.network.list(kind))\n        break\n      }\n      case opNames.sendContainer: {\n        const target: ContainerUuid = params[0]\n        const operation: string = params[1]\n        const data: any = params[2]\n        await send(await this.network.request(target, operation, data))\n        break\n      }\n\n      default:\n        throw new Error('Unknown method' + method)\n    }\n  }\n\n  lastClients = 0\n  async helloHandler (clientId: ClientUuid): Promise<void> {\n    if (!this.clients.has(clientId)) {\n      console.log(`Clients connected: ${this.clients.size}`)\n    }\n    this.clients.add(clientId)\n    this.network.addClient(clientId, async (event) => {\n      await this.rpcServer.send(clientId, event)\n    })\n  }\n\n  onPing (client: ClientUuid): void {\n    this.network.ping(client)\n  }\n","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/net/packages/server/src/server.ts#L102-L138","documentation":"requestHandler dispatches client requests on a numeric method code (e.g. hello/request-style opcodes) via a switch; the default branch throws for any code the server does not implement. The thrown message concatenates the raw method value, making unsupported opcode attempts identifiable. It signals a protocol-level mismatch between client and server.","triggerScenarios":"A client sends a request whose method code is outside the handled set — newer client against older server, a corrupted/garbage method value, or a hand-rolled client using the wrong opcode numbers.","commonSituations":"Version skew where the client added a new method code the running server doesn't know; proxy in front of the server altering or stripping messages; fuzzing or malicious clients sending arbitrary opcodes; misconfigured client pointing at a different service version.","solutions":["Check the method value in the error and confirm the client is sending a code this server version supports.","Align client and server versions so their protocol opcodes match (upgrade the older side).","Inspect messages between client and server (logs/proxy) for corruption or unexpected method values.","If you control the codebase, extend requestHandler's switch to implement the new method code server-side."],"exampleFix":"// before\nclass MyClient extends Client { async ping() { return this.call(99, []) } } // opcode 99 unsupported\n// after\nclass MyClient extends Client { async ping() { return this.call(METHOD_REQUEST, ['ping']) } }\n// or server-side:\ndefault:\n  throw new Error(`Unknown method: ${method}`) // improve message, then add the missing case","handlingStrategy":"try-catch","validationCode":"const KNOWN_METHODS = new Set([METHOD_HELLO, METHOD_REQUEST /* ... */])\nif (!KNOWN_METHODS.has(method)) {\n  throw new Error(`refusing to send unknown method code ${method}`)\n}\nawait client.call(method, params)","typeGuard":"function isKnownMethod(m: number): m is MethodCode {\n  return KNOWN_METHODS.has(m as MethodCode)\n}","tryCatchPattern":"try {\n  await client.call(method, params)\n} catch (e) {\n  if (typeof (e as Error).message === 'string' && e.message.startsWith('Unknown method')) {\n    console.error(`server rejected method code ${method} — version mismatch or bad opcode`, e)\n    // renegotiate/upgrade client or fall back to a supported method\n  } else throw e\n}","preventionTips":["Share a single enum of method codes between client and server packages.","Negotiate the protocol version in the hello handshake and refuse incompatible peers.","Never hardcode numeric opcodes at call sites; reference the shared enum.","Add a conformance test that exercises every supported method code against the server."],"tags":["protocol","rpc","unknown-method","version-skew"],"backgroundTag":"unknown-method","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}