{"record":{"id":"a355851676903cbd","repo":"hcengineering/platform","slug":"unknown-method-method","errorCode":null,"errorMessage":"Unknown method${method}","messagePattern":"Unknown method(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/net/packages/client/src/agent.ts","lineNumber":104,"sourceCode":"        container.disconnect(client)\n        await send('ok')\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\n        const container = await this.agent.getContainer(target)\n        if (container === undefined) {\n          throw new Error('Container not found')\n        }\n        await send(await container.request(operation, data, client))\n        break\n      }\n\n      default:\n        throw new Error('Unknown method' + method)\n    }\n  }\n\n  async helloHandler (clientId: ClientUuid): Promise<void> {\n    console.log(`Client ${clientId} connected`)\n  }\n\n  async closeHandler (client: ClientUuid): Promise<void> {\n    console.log(`Client ${client} timed out`)\n  }\n}\n\n/**\n * An routed connection to a container via agent.\n */\nexport class RoutedNetworkAgentConnectionImpl<ClientT extends string = ClientId> {\n  private readonly client: BackRPCClient<ClientT>\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/net/packages/client/src/agent.ts#L86-L122","documentation":"The agent requestHandler's switch fell through to default because the incoming method name matched none of the known opNames. The thrown message concatenates the unknown method name. This is a protocol-level mismatch between caller and agent.","triggerScenarios":"Calling client.request with a method string not in opNames (typo, wrong casing, method from a newer/older protocol version, or an empty method).","commonSituations":"Client and agent versions out of sync after an upgrade adding new ops; hand-written method names instead of the opNames constants; typos like 'SendContainer' vs 'sendContainer'.","solutions":["Use the exported opNames constants instead of raw strings for method names","Align client and agent package versions so both support the operation","Log the method value in the error and fix the misspelling","Add client-side validation of allowed methods before sending"],"exampleFix":"// before\nawait client.request('sendcontaner', params)\n// after\nimport { opNames } from '@evil-corp/net-client'\nawait client.request(opNames.sendContainer, params)","handlingStrategy":"validation","validationCode":"const allowed = Object.values(opNames) as string[]\nif (!allowed.includes(method)) {\n  throw new Error(`Unsupported method: ${method}`)\n}","typeGuard":"function isKnownOp(method: string): method is typeof opNames[keyof typeof opNames] {\n  return (Object.values(opNames) as string[]).includes(method)\n}","tryCatchPattern":"try {\n  await client.request(method, params)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unknown method')) {\n    console.error(`Op ${method} not supported by this agent build; check versions`)\n  } else { throw e }\n}","preventionTips":["Always use opNames constants, never raw strings","Keep client and agent package versions in sync","Validate method names at call sites","Add protocol version handshake checks"],"tags":["protocol","unknown-method","version-mismatch"],"backgroundTag":"unknown-rpc-method","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}