How to fix Error 4173 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 4173 — “Is Not a Valid Scoring Function Name”

Why This Error Happens

This error occurs when SQL Server 2025’s native scoring engine (used for PREDICT/scoring operations against ONNX or in-database ML models) cannot locate or validate the scoring function name referenced in a PREDICT statement or a model’s metadata. This typically happens due to a typo or case-sensitivity mismatch in the function name, a corrupted or incompatible model schema stored in the RxPredict/native scoring catalog, or missing registration of the scoring function after a model import. It can also surface after a failed or partial upgrade where the internal scoring function catalog became out of sync with the installed model binaries.

Step-by-Step Resolution Guide

Step 1: Validate the Scoring Function Name and Syntax

  • Open the query that raised the error and inspect the exact string passed to the PREDICT clause or scoring function parameter.
  • Confirm there are no leading/trailing spaces, incorrect casing, or special characters in the function name.
  • Cross-check the name against the list of valid scoring functions by running:
  SELECT name, scoring_function_type FROM sys.native_scoring_functions;

Step 2: Verify the Model and Function Registration

  • Check whether the model was registered correctly using sp_rxPredict or the native PREDICT model catalog:
  SELECT * FROM sys.models WHERE model_name = 'YourModelName';
  • If the function is missing or shows as NULL, re-import the model using:
  EXEC sp_rxPredict @model = @model_binary, @inputData = N'SELECT * FROM InputTable';
  • Ensure the model file (ONNX or PMML) was exported using a compatible version matching SQL Server 2025’s native scoring engine.

Step 3: Repair the Native Scoring Catalog

  • Navigate to C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\ and confirm the rxLibs and mlModelSvc.dll components are present and not flagged by antivirus/Windows Defender exclusions.
  • Restart the SQL Server Launchpad service via services.msc or:
  Restart-Service MSSQLLaunchpad
  • If the catalog remains corrupted, drop and recreate the model entry:
  DROP EXTERNAL MODEL [YourModelName];
  CREATE EXTERNAL MODEL [YourModelName] 
  FROM 'C:\Models\model.onnx' 
  WITH (FORMAT = 'ONNX');

Step 4: Apply the Latest Cumulative Update

  • Confirm you are running the latest SQL Server 2025 CU, as early releases had known native scoring catalog sync bugs.
  • Check your current build:
  SELECT @@VERSION;
  • Download and apply the latest CU from the Microsoft Update Catalog if your build number predates the fix.

Alternative or Verification Steps

  • Re-run the original PREDICT query after completing the steps above; the error should no longer appear, and results should return normally.
  • If the issue persists, enable extended events tracing (xe_store.scoring_errors) to capture the exact internal function lookup failure and compare against Microsoft’s native scoring function reference list for SQL Server 2025.