{"record":{"id":"3d016b27cca6ea26","repo":"dotnet/efcore","slug":"the-dbfunction-function-does-not-have-a-parame","errorCode":null,"errorMessage":"The DbFunction '{function}' does not have a parameter named '{parameter}'.","messagePattern":"The DbFunction '(.+?)' does not have a parameter named '(.+?)'\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Relational/Metadata/Internal/InternalDbFunctionBuilder.cs","lineNumber":235,"sourceCode":"    /// </summary>\n    public virtual bool CanSetTranslation(\n        Func<IReadOnlyList<SqlExpression>, SqlExpression>? translation,\n        ConfigurationSource configurationSource)\n        => (Metadata is { IsScalar: true, IsAggregate: false } || configurationSource == ConfigurationSource.Explicit)\n            && (configurationSource.Overrides(Metadata.GetTranslationConfigurationSource())\n                || Metadata.Translation == translation);\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    public virtual InternalDbFunctionParameterBuilder HasParameter(string name, ConfigurationSource configurationSource)\n    {\n        var parameter = Metadata.FindParameter(name);\n        return parameter == null\n            ? throw new ArgumentException(\n                RelationalStrings.DbFunctionInvalidParameterName(Metadata.MethodInfo?.DisplayName(), name))\n            : parameter.Builder;\n    }\n\n    IConventionDbFunction IConventionDbFunctionBuilder.Metadata\n    {\n        [DebuggerStepThrough]\n        get => Metadata;\n    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    [DebuggerStepThrough]\n    IConventionDbFunctionBuilder? IConventionDbFunctionBuilder.HasAnnotation(string name, object? value, bool fromDataAnnotation)","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Relational/Metadata/Internal/InternalDbFunctionBuilder.cs#L217-L253","documentation":"Thrown by InternalDbFunctionBuilder.HasParameter when Metadata.FindParameter(name) returns null — i.e. no parameter with the requested name exists on the DbFunction. The builder cannot return a parameter builder for a parameter that was never declared.","triggerScenarios":"Calling .HasParameter(\"someName\") where 'someName' does not match any parameter of the underlying method (typo, wrong casing, or a renamed parameter). Also when configuring a DbFunction built via the string overload with no parameters declared.","commonSituations":"Parameter renamed in the method signature but the fluent config still uses the old name. Mismatch between the case/spacing of the parameter name and the string passed to HasParameter.","solutions":["Correct the parameter name to exactly match a parameter of the mapped method (case-sensitive).","If you used the string-based DbFunction constructor, ensure parameters were supplied via the parameters argument.","Use nameof(...) on the method parameter instead of a string literal to avoid typos.","List the function's parameters (FindParameter / Parameters) to confirm available names before configuring."],"exampleFix":"// before\npublic decimal TaxFor(decimal amount, string region) => 0m;\nmodelBuilder.HasDbFunction(typeof(Ctx).GetMethod(\"TaxFor\"))\n    .HasParameter(\"amt\").HasPropagatesNullability(false); // wrong name\n\n// after\nmodelBuilder.HasDbFunction(typeof(Ctx).GetMethod(\"TaxFor\"))\n    .HasParameter(nameof(TaxFor) /* not valid */ );\n// better: derive from the method\nmodelBuilder.HasDbFunction(typeof(Ctx).GetMethod(\"TaxFor\"))\n    .HasParameter(\"amount\").HasPropagatesNullability(false);","handlingStrategy":"validation","validationCode":"// Verify the parameter exists before configuring\nvar param = fn.FindParameter(name);\nif (param is null)\n    throw new InvalidOperationException($\"No parameter '{name}' on {fn.ModelName}.\");\nparam.Builder.HasPropagatesNullability(false);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use nameof(...) or derive parameter names from the method signature, not string literals.","When renaming a method parameter, search for the old string in HasParameter calls.","Prefer FindParameter over HasParameter when the name may not exist."],"tags":["efcore","dbfunction","parameter","model-building"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}