Skip to content

Latest commit

 

History

History
516 lines (356 loc) · 11.6 KB

error-messages.md

File metadata and controls

516 lines (356 loc) · 11.6 KB
tags
errors
troubleshooting
reference
data-engineering
ml
genai

Common Error Messages and Solutions

Delta Lake Errors

VACUUM Retention Error

VACUUM cannot delete files more recent than 168 hours

Cause: Attempting to VACUUM with retention less than default 7 days.

Solution:

-- Option 1: Use longer retention
VACUUM table_name RETAIN 168 HOURS;

-- Option 2: Disable safety check (dangerous!)
SET spark.databricks.delta.retentionDurationCheck.enabled = false;
VACUUM table_name RETAIN 0 HOURS;

Schema Mismatch Error

A schema mismatch detected when writing to the Delta table

Cause: Incoming data schema doesn't match table schema.

Solution:

# Option 1: Enable schema evolution
df.write.option("mergeSchema", "true").format("delta").mode("append").save(path)

# Option 2: Overwrite schema
df.write.option("overwriteSchema", "true").format("delta").mode("overwrite").save(path)

Concurrent Write Conflict

ConcurrentAppendException: Files were added to the table by a concurrent update

Cause: Multiple writers modifying the same partition/files.

Solution:

  • Use isolation level settings
  • Implement retry logic
  • Consider partitioning strategy
# Retry logic
from delta.exceptions import ConcurrentAppendException
import time

max_retries = 3
for attempt in range(max_retries):
    try:
        df.write.format("delta").mode("append").save(path)
        break
    except ConcurrentAppendException:
        time.sleep(2 ** attempt)

Time Travel Version Not Found

The requested version X does not exist

Cause: Version has been removed by VACUUM or doesn't exist.

Solution:

-- Check available versions
DESCRIBE HISTORY table_name;

-- Use available version
SELECT * FROM table_name VERSION AS OF <available_version>;

Streaming Errors

Checkpoint Incompatibility

The checkpoint of your query is incompatible with the current version

Cause: Query structure changed after checkpoint was created.

Solution:

  1. Delete checkpoint directory
  2. Restart stream from scratch
  3. Or: Reprocess from beginning with new checkpoint location

Missing Checkpoint Location

checkpointLocation must be specified

Solution:

(df.writeStream
    .option("checkpointLocation", "/path/to/checkpoint")
    .format("delta")
    .start())

Watermark Required for State

Streaming aggregation requires watermark for state cleanup

Solution:

(df.withWatermark("event_time", "10 minutes")
    .groupBy(window("event_time", "5 minutes"))
    .count())

Auto Loader Errors

Schema Location Required

'cloudFiles.schemaLocation' must be specified

Solution:

(spark.readStream.format("cloudFiles")
    .option("cloudFiles.format", "json")
    .option("cloudFiles.schemaLocation", "/path/to/schema")
    .load("/data/path"))

Schema Evolution Rescue

Found new columns that cannot be added to schema

Solution:

# Use rescue column for unexpected data
(spark.readStream.format("cloudFiles")
    .option("cloudFiles.format", "json")
    .option("cloudFiles.schemaEvolutionMode", "rescue")
    .option("cloudFiles.schemaLocation", "/schema")
    .load("/data"))

Unity Catalog Errors

Permission Denied

User does not have privilege SELECT on table

Solution:

-- Grant permission
GRANT SELECT ON TABLE catalog.schema.table TO `user@email.com`;

-- Check current grants
SHOW GRANTS ON TABLE catalog.schema.table;

Catalog Not Found

Catalog 'catalog_name' not found

Solution:

-- List available catalogs
SHOW CATALOGS;

-- Create if needed (requires admin)
CREATE CATALOG catalog_name;

-- Use correct catalog
USE CATALOG correct_catalog_name;

External Location Permission

User does not have permission to access external location

Solution:

GRANT READ FILES ON EXTERNAL LOCATION location_name TO `user@email.com`;
GRANT WRITE FILES ON EXTERNAL LOCATION location_name TO `user@email.com`;

Spark Errors

Out of Memory

java.lang.OutOfMemoryError: Java heap space

Solutions:

  1. Increase executor memory
  2. Reduce data per partition
  3. Cache strategically
  4. Use disk-based shuffle
# Increase partitions to reduce per-partition memory
spark.conf.set("spark.sql.shuffle.partitions", 500)

# Spill to disk
spark.conf.set("spark.memory.fraction", 0.4)

Task Serialization Error

org.apache.spark.SparkException: Task not serializable

Cause: Non-serializable object used in transformation.

Solution:

# Bad: Using non-serializable object
connection = get_db_connection()
df.map(lambda x: connection.query(x))  # Error!

# Good: Create connection inside transformation
def process_row(row):
    connection = get_db_connection()
    return connection.query(row)

df.map(process_row)

Shuffle Block Fetch Failure

FetchFailedException: Failed to fetch block

Causes: Network issues, executor failures, memory pressure.

Solutions:

# Increase retry attempts
spark.conf.set("spark.shuffle.io.maxRetries", 10)
spark.conf.set("spark.shuffle.io.retryWait", "30s")

# Reduce shuffle block size
spark.conf.set("spark.sql.shuffle.partitions", 1000)

Lakeflow Pipelines Errors (formerly DLT)

Lakeflow Spark Declarative Pipelines was formerly Lakeflow Declarative Pipelines / Delta Live Tables (DLT).

Expectation Failure

Pipeline stopped due to expectation violation

Cause: Data failed an EXPECT...ON VIOLATION FAIL UPDATE constraint (@dp.expect_or_fail in Python). Only the flow that hit the violation fails; other flows in the pipeline continue.

Solution:

  1. Check the pipeline event log for failed records (event_log(TABLE(...)) or event_log('<pipeline-id>'))
  2. Fix source data or adjust expectation
  3. Change to DROP ROW if failures are acceptable

Circular Dependency

Circular dependency detected in pipeline

Solution: Review and remove table dependencies that form cycles.

MLflow and Model Registry Errors

Wrong Registry URI

MlflowException: No such model version found

Cause: Using workspace registry URI when model is registered in Unity Catalog (or vice versa).

In MLflow 3 the default registry URI on Databricks is databricks-uc; on MLflow 2.x the workspace registry was the usual default, so older notebooks that never call set_registry_uri can change behavior after an upgrade (MLflow 3 on Databricks).

Solution:

import mlflow

# For Unity Catalog models
mlflow.set_registry_uri("databricks-uc")
client = mlflow.tracking.MlflowClient(registry_uri="databricks-uc")

# For workspace registry (legacy)
mlflow.set_registry_uri("databricks")

Model Signature Mismatch

MlflowException: Incompatible input types for the model signature

Cause: Input DataFrame schema does not match the model's logged signature.

Solution:

# Check model signature
import mlflow.pyfunc
model = mlflow.pyfunc.load_model("models:/catalog.schema.model@champion")
print(model.metadata.signature)

# Ensure input matches expected schema
# Cast columns if needed before calling predict()

Alias Not Found

MlflowException: Registered model alias 'champion' not found

Cause: The @champion alias has not been assigned to any version yet.

Solution:

from mlflow import MlflowClient
client = MlflowClient(registry_uri="databricks-uc")

client.set_registered_model_alias(
    name="catalog.schema.model_name",
    alias="champion",
    version="1",
)

Model Serving Errors

Wrong Payload Format

{"error_code": "BAD_REQUEST", "message": "Failed to parse request"}

Cause: Request body does not match the expected serving input format.

Solution:

import requests

# Correct format for pyfunc models
payload = {
    "dataframe_records": [
        {"feature1": 1.0, "feature2": "value"}
    ]
}

# Or for tensor-based models
payload = {
    "inputs": [[1.0, 2.0, 3.0]]
}

Scale-to-Zero Cold Start Timeout

{"error_code": "REQUEST_TIMEOUT", "message": "Endpoint is initializing"}

Cause: Endpoint scaled to zero and the first request arrived before warm-up completed.

Solution:

  • Disable scale-to-zero for latency-sensitive or canary test endpoints
  • Implement client-side retry with exponential backoff
from databricks.sdk.service.serving import ServedEntityInput

# served_entities / ServedEntityInput; served_models / ServedModelInput is deprecated
# (https://databricks-sdk-py.readthedocs.io/en/latest/dbdataclasses/serving.html)
ServedEntityInput(
    entity_name="catalog.schema.model",
    entity_version="1",
    scale_to_zero_enabled=False,  # Keep warm for SLA compliance
)

Endpoint Config Update Conflict

{"error_code": "RESOURCE_CONFLICT", "message": "Endpoint is being updated"}

Cause: Attempting to update endpoint configuration while a previous update is in progress.

Solution: Poll endpoint state and wait for READY status before applying the next update.

Vector Search (AI Search) and GenAI Errors

Vector Search is now called AI Search in the docs; error text may use either name.

Vector Index Not Ready

DatabricksError: Vector search index is not in READY state

Cause: Index creation or sync is still in progress.

Solution:

from databricks.vector_search.client import VectorSearchClient

vsc = VectorSearchClient()
index = vsc.get_index(endpoint_name="my_endpoint", index_name="catalog.schema.index")

# Wait for READY state before querying
index.describe()  # Check state field

CDF Not Enabled for Delta Sync Index

DatabricksError: Change Data Feed must be enabled on the source Delta table

Cause: Attempting to create a DELTA_SYNC vector index on a table without CDF enabled.

Solution:

ALTER TABLE catalog.schema.my_table
SET TBLPROPERTIES ('delta.enableChangeDataFeed' = 'true');

Embedding Dimension Mismatch

DatabricksError: Query vector dimension (768) does not match index dimension (1536)

Cause: Query was embedded with a different model than the one used to build the index.

Solution: Always use the same embedding model for indexing and querying. Never change the embedding model on an existing index; rebuild the index instead.

Foundation Model API Rate Limit

{"error_code": "TOO_MANY_REQUESTS", "message": "Rate limit exceeded"}

Solution:

  • Implement exponential backoff with jitter
  • Use provisioned throughput for production workloads with guaranteed QPS
  • Batch embedding requests to reduce call volume

Common Solutions Summary

Error Type First Step
Permission Check SHOW GRANTS
Schema Enable mergeSchema
Memory Increase partitions
Checkpoint Delete and restart
Concurrency Add retry logic
Time Travel Check DESCRIBE HISTORY
Wrong registry Set mlflow.set_registry_uri()
Model signature Print and match model.metadata.signature
Scale-to-zero cold start Disable scale_to_zero_enabled
Vector index not ready Wait for READY state; enable CDF
Embedding mismatch Use same model for index and query