{"record":{"id":"693462345edeeb72","repo":"microsoft/typescript-go","slug":"unknown-api-method-q","errorCode":null,"errorMessage":"unknown API method %q","messagePattern":"unknown API method %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/api/proto.go","lineNumber":1454,"sourceCode":"\treturn resp\n}\n\n// NewDiagnosticResponses converts a slice of ast.Diagnostics to DiagnosticResponses.\nfunc NewDiagnosticResponses(diags []*ast.Diagnostic) []*DiagnosticResponse {\n\tif len(diags) == 0 {\n\t\treturn nil\n\t}\n\tresult := make([]*DiagnosticResponse, len(diags))\n\tfor i, d := range diags {\n\t\tresult[i] = NewDiagnosticResponse(d)\n\t}\n\treturn result\n}\n\nfunc unmarshalPayload(method string, payload json.Value) (any, error) {\n\tunmarshaler, ok := unmarshalers[Method(method)]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unknown API method %q\", method)\n\t}\n\treturn unmarshaler(payload)\n}\n\nfunc unmarshallerFor[T any](data []byte) (any, error) {\n\tvar v T\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal %T: %w\", (*T)(nil), err)\n\t}\n\treturn &v, nil\n}\n\nfunc noParams(data []byte) (any, error) {\n\treturn nil, nil\n}\n","sourceCodeStart":1436,"sourceCodeEnd":1470,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/api/proto.go#L1436-L1470","documentation":"unmarshalPayload looks the method string up in the server's generated unmarshaler registry; no entry means this server build has never heard of the method. The request fails at payload-decode time and never reaches a handler, so even param-less calls fail.","triggerScenarios":"A client on a newer protocol calling a method this server build doesn't have; a typo'd, renamed, or differently-cased method string; whitespace padding around the method name.","commonSituations":"Version skew after upgrading the client library but not the server; copy-pasted method names; custom methods not registered server-side.","solutions":["Check the exact method string against the server's Method constants in proto.go","Align client and server to the same typescript-go version","After connecting, negotiate capabilities via initialize and only call methods the server supports","Trim and normalize method names before sending"],"exampleFix":"// before\nclient.Call(ctx, \"getdiagnostics\", params) // typo\n\n// after\nclient.Call(ctx, string(api.MethodGetDiagnostics), params)","handlingStrategy":"validation","validationCode":"var supported = map[string]bool{\n\tstring(api.MethodInitialize): true,\n\tstring(api.MethodGetDiagnostics): true,\n\t// ... keep in sync with the server build\n}\nif !supported[method] {\n\treturn fmt.Errorf(\"method %q not supported by this server build\", method)\n}\nres, err := client.Call(ctx, method, params)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Source method strings from the server's Method constants, never literals","Negotiate capabilities at initialize and gate calls on them","Keep client and server versions locked together"],"tags":["go","unknown-method","version-skew","dispatch","typo"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}