Troubleshoot Model Serving endpoints

Troubleshoot a Model Serving endpoint that fails to build or start, fails to load its model, or returns errors on requests. This page covers the errors that appear during the build and while the endpoint runs.

Tip

Having deployment issues? Start with pre-deployment validation to catch common problems before they occur.

Debug your container build

Databricks recommends reviewing logs for debugging and troubleshooting errors in your model serving workloads. See Monitor Model Serving endpoints for information about logs and how to view them.

The event logs (select the Events tab on the endpoint page) contain information about the progress of a container build. A successful container build shows a SERVED_ENTITY_CONTAINER_EVENT event type with the message Container image creation finished successfully. If you do not see any build event or message after an hour of creating the endpoint, reach out to Databricks support for assistance.

If your build succeeds but you encounter other errors, see Debug after container build succeeds. If your build fails, see Debug after container build failure.

Debug after container build succeeds

The container can build and still fail when the model runs or while the endpoint operates.

Note

If your model code returns MlflowException errors, expect the response code to be mapped to a 4xx response. Databricks considers these model code errors to be customer-caused errors, since they can be resolved based on the resulting error message. 5xx error codes are reserved to communicate errors where Databricks is at fault.

No module named '<module-name>'

You might get an error like the following:

An error occurred while loading the model: No module named '<module-name>'

This error might indicate that a dependency is missing from the container.

Recommended solution: Verify that every dependency you need in the container build is declared for the model. Pay special attention to custom libraries and ensure that the .whl files are included as artifacts.

Encountered an unexpected error while evaluating the model

You might receive an error like the following when predict() is called on your model:

Encountered an unexpected error while evaluating the model. Verify that the input is compatible with the model for inference.

This error can indicate a code issue in the predict() function.

Recommended solution: Load the model from MLflow in a notebook and call it. The notebook highlights the issues in the predict() function, and it shows where the failure happens within the method.

Check: the same input returns a prediction in the notebook instead of this error.

Many requests stall at the same time on a CPU endpoint

Many requests on a CPU endpoint might slow down or time out at the same time. If that slowdown lines up with a slow external service that your model calls, a call that blocks in compiled code might be holding a worker. See Blocking calls in model code on CPU endpoints.

Root cause analysis of failed requests

If a request to an endpoint fails, you can perform root cause analysis by using inference tables. If enabled, inference tables automatically log requests and responses to your endpoint in a Unity Catalog table for you to query. If the endpoint has a sampling rate below 100%, the table holds only a sample of the requests.

To query inference tables:

  1. Select Serving in the sidebar, then select your endpoint name.
  2. In the Inference tables section, find the inference table's fully-qualified name. For example, my-catalog.my-schema.my-table.
  3. Run the following in a Azure Databricks notebook:
    SELECT * FROM `my-catalog`.`my-schema`.`my-table`
    
    The results include the request, response, request_time, and status_code columns.
  4. View and filter on the columns to understand the requests and narrow down results.
    SELECT * FROM `my-catalog`.`my-schema`.`my-table`
    WHERE status_code != 200
    
    The results contain only the requests with a status code other than 200.
  5. If you enabled agent tracing for agents, see the Response column to view detailed traces. See Enable inference tables for agents.

Workspace exceeded provisioned concurrency quota

You might receive a Workspace exceeded provisioned concurrency quota error. This indicates that you have reached your workspace quota for provisioned concurrency. For concurrency limits, see Model Serving limits and regions.

Recommended solution: You can free up this quota by deleting or stopping unused endpoints. This limit can be increased depending on region availability. Reach out to your Databricks account team and provide your workspace ID to request a concurrency increase.

Exceeded max number of parallel requests

You might receive the following 429 error:

Exceeded max number of parallel requests. Please contact your Databricks representative to increase the limit

Provisioned throughput endpoints return this error. Custom model serving endpoints don't. This limit indicates that you have reached the workspace limit on the maximum number of requests that can be sent in parallel. See Model Serving limits and regions for more information about this limit.

Recommended solution: Reduce the number of clients sending inference requests, or contact your Databricks representative for a quota increase.

Too many concurrent requests

You might receive the following 429 error:

Too many concurrent requests. Consider increasing the provisioned concurrency of the served entity.

This error indicates that your endpoint's current provisioned concurrency can't handle the incoming traffic volume.

Recommended solution: If your endpoint's maximum provisioned concurrency is higher than its minimum, the system automatically provisions additional concurrency up to the endpoint's configured limit to handle the increased load. If the minimum and maximum are the same, consider increasing the provisioned concurrency or raising the maximum to handle traffic spikes.

Request rate increased too quickly

You might receive the following 429 error:

Request rate increased too quickly. Please reduce your request rate and ramp up gradually over several minutes.

Any endpoint type can return this error when the workspace has too many requests in flight at the same time.

Recommended solution: Reduce the request rate and ramp up gradually over several minutes.

Max request size exceeded for a scale to zero endpoint

You might receive an HTTP 400 error with the following message:

Max request size exceeded for a scale to zero endpoint. Please reduce the request size or use an endpoint without scale to zero.

The endpoint has scale to zero enabled, the request body was larger than 1 MiB, and the endpoint couldn't serve the request.

Recommended solution: Reduce the request size to 1 MiB or less, or use an endpoint without scale to zero.

Debug after container build failure

Use these entries when the build fails or a GPU deployment doesn't get capacity.

When a build fails, the served entity's status and the event logs can show this message:

Container build failed. Cause: <cause>. See Build Logs for details.

Check the cause first, then find the failing command in the build logs. If the cause is ambiguous_other, Azure Databricks couldn't match the failure to a known cause, so go straight to the build logs.

OSError: [Errno 28] No space left on device

The No space left error can be due to too many large artifacts being logged alongside the model unnecessarily.

Recommended solution: Check in MLflow that extraneous artifacts are not logged alongside the model and try to redeploy the slimmed down package.

Build can't start because of an Azure storage firewall or Private Link

You might see an error like the following:

Build could not start due to an internal error. If you are serving a model from UC and Azure storage firewall or Private Link is configured on your storage account, please verify your network connectivity is configured properly according to https://learn.microsoft.com/en-us/azure/databricks/security/network/serverless-network-security/serverless-private-link. For additional assistance, contact Databricks Support.

This error occurs when you serve a model from Unity Catalog and the storage account's firewall or Private Link rejects the build.

Recommended solution: Check the Azure storage firewall or Private Link configuration on your storage account. If the build still fails, contact Databricks Support.

Build could not start due to an internal error - please contact your Databricks representative

The build couldn't start because of an internal error.

Recommended solution: Reach out to your Databricks account team to help resolve.

GPU deployment doesn't get capacity

Due to restrictions in GPU supply and availability, a GPU deployment might not get capacity. When that happens, the deployment waits until it times out and then fails. The served entity's state.deployment is DEPLOYMENT_ABORTED, and its state.deployment_state_message can read:

served entity creation aborted because there is not enough capacity for the requested compute type in this region. Please try again later or choose a different workload type, and if the problem persists, please contact support@databricks.com.

Recommended solution: Try again later, or choose a different workload type. If the problem persists, reach out to your Databricks account team to help resolve. Depending on region availability, the team can provision more GPU resources.

Check: the served entity's state.deployment is no longer DEPLOYMENT_ABORTED after you try again.

Installed library package versions

Databricks recommends that you define all important libraries as model dependencies to ensure consistent and reproducible model behavior across environments. In the build logs you can confirm the package versions that are installed correctly.

  • For MLflow versions, if you do not have a version specified, Model Serving uses the latest version.
  • For custom GPU serving, Model Serving installs the recommended versions of cuda and cuDNN according to public PyTorch and Tensorflow documentation.

Log models that require flash-attn

If you are logging a model that requires flash-attn, Databricks recommends using a custom wheel version of flash-attn. Otherwise, build errors such as ModuleNotFoundError: No module named 'torch' can result.

To use a custom wheel version of flash-attn, specify all pip requirements as a list and pass it as a parameter into your mlflow.transformers.log_model function. You must also specify the PyTorch, torch, and torchvision versions that are compatible with the CUDA version specified in your flash-attn wheel.

For example, Databricks recommends using the following versions and wheels for CUDA 11.8:

This sample is a fragment. Import mlflow, and define test_pipeline, input_example, and registered_model_name before you run it.


logged_model=mlflow.transformers.log_model(
transformers_model=test_pipeline,
       artifact_path="artifact_path",
       pip_requirements=["--extra-index-url https://download.pytorch.org/whl/cu118", "mlflow==2.13.1", "setuptools<70.0.0", "torch==2.0.1+cu118", "accelerate==0.31.0", "astunparse==1.6.3", "bcrypt==3.2.0", "boto3==1.34.39", "configparser==5.2.0", "defusedxml==0.7.1", "dill==0.3.6", "google-cloud-storage==2.10.0", "ipython==8.15.0", "lz4==4.3.2", "nvidia-ml-py==12.555.43", "optree==0.12.1", "pandas==1.5.3", "pyopenssl==23.2.0", "pytesseract==0.3.10", "scikit-learn==1.3.0", "sentencepiece==0.1.99", "torchvision==0.15.2+cu118", "transformers==4.41.2", "https://github.com/Dao-AILab/flash-attention/releases/download/v2.5.8/flash_attn-2.5.8+cu118torch2.0cxx11abiFALSE-cp311-cp311-linux_x86_64.whl"],
       input_example=input_example,
       registered_model_name=registered_model_name)

Additional resources

Resource Description
Monitor Model Serving endpoints Find build logs, service logs, and metrics for an endpoint.
Timeouts in Model Serving Diagnose deployment, server-side, and client-side timeouts.