{"record":{"id":"7f0dd9c27f3e256b","repo":"reactiveui/refit","slug":"methodname-exists-more-than-once-parametertypes","errorCode":null,"errorMessage":"MethodName exists more than once, 'parameterTypes' mut be defined","messagePattern":"MethodName exists more than once, 'parameterTypes' mut be defined","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Refit.Reflection/RequestBuilderImplementation.cs","lineNumber":382,"sourceCode":"    /// <exception cref=\"InvalidOperationException\">None of the overloads accept <paramref name=\"parameterTypes\"/> once closed over <paramref name=\"genericArgumentTypes\"/>.</exception>\n    [RequiresUnreferencedCode(\"Resolving generic Refit methods from reflected metadata requires generic method metadata to be available at runtime.\")]\n    [RequiresDynamicCode(\"Resolving generic Refit methods from reflected metadata requires runtime generic method instantiation.\")]\n    internal RestMethodInfoInternal FindMatchingRestMethodInfo(\n        string key,\n        Type[]? parameterTypes,\n        Type[]? genericArgumentTypes)\n    {\n        if (!_interfaceHttpMethods.TryGetValue(key, out var httpMethods))\n        {\n            throw new ArgumentException(\n                \"Method must be defined and have an HTTP Method attribute\");\n        }\n\n        if (parameterTypes is null)\n        {\n            if (httpMethods.Count > 1)\n            {\n                throw new ArgumentException(\n                    $\"MethodName exists more than once, '{nameof(parameterTypes)}' mut be defined\");\n            }\n\n            return CloseGenericMethodIfNeeded(httpMethods[0], genericArgumentTypes);\n        }\n\n        var possibleMethods = FilterPossibleMethods(httpMethods, parameterTypes, genericArgumentTypes);\n\n        if (possibleMethods.Length == 1)\n        {\n            return CloseGenericMethodIfNeeded(possibleMethods[0], genericArgumentTypes);\n        }\n\n        foreach (var method in possibleMethods)\n        {\n            try\n            {\n                var closedMethod = CloseGenericMethodIfNeeded(method, genericArgumentTypes);","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/reactiveui/refit/blob/b455f65ecc4c97d092317e349cb775f9cfc6bcdf/src/Refit.Reflection/RequestBuilderImplementation.cs#L364-L400","documentation":"An interface method name maps to more than one HTTP-attributed overload, but the caller did not supply parameterTypes to disambiguate. The resolver cannot pick between overloads on its own, so it demands the parameter type array. (The message has a known typo: 'mut' instead of 'must'.)","triggerScenarios":"Calling an overloaded Refit method name through a code path that resolves by name only (e.g. some dynamic/generated invokers) where two overloads both carry HTTP attributes, without supplying the argument type list.","commonSituations":"Two overloads of the same method name both annotated with HTTP attributes; refactoring that added an overload; using a Refit extension that resolves by name only.","solutions":["Supply the parameterTypes argument when resolving the method so the overload can be disambiguated.","If you control the interface, rename one overload or drop the duplicate attribute so only one HTTP overload of that name remains.","Differentiate overloads with distinct HTTP routes/verbs instead of identical names."],"exampleFix":"// before\npublic interface IApi {\n    [Get(\"/items/{id}\")]    Task<Item> GetAsync(int id);\n    [Get(\"/items/{slug}\")] Task<Item> GetAsync(string slug); // ambiguous name\n}\n\n// after (distinct names)\npublic interface IApi {\n    [Get(\"/items/{id}\")]  Task<Item> GetByIdAsync(int id);\n    [Get(\"/items/{slug}\")] Task<Item> GetBySlugAsync(string slug);\n}","handlingStrategy":"validation","validationCode":"// Disambiguate overloads by supplying parameter types when resolving.\nvar info = builder.FindMatchingRestMethodInfo(nameof(IApi.GetAsync), new[] { typeof(int) }, null);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid two HTTP-attributed overloads with the same name.","Differentiate overloads by distinct routes or names.","When resolving by name, always pass parameterTypes."],"tags":["refit","overloads","reflection","design-time"],"backgroundTag":null,"analyzedSha":"b455f65ecc4c97d092317e349cb775f9cfc6bcdf","analyzedAt":"2026-08-13T21:20:57.878Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}