| tags |
|
|---|
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;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)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)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>;The checkpoint of your query is incompatible with the current version
Cause: Query structure changed after checkpoint was created.
Solution:
- Delete checkpoint directory
- Restart stream from scratch
- Or: Reprocess from beginning with new checkpoint location
checkpointLocation must be specified
Solution:
(df.writeStream
.option("checkpointLocation", "/path/to/checkpoint")
.format("delta")
.start())Streaming aggregation requires watermark for state cleanup
Solution:
(df.withWatermark("event_time", "10 minutes")
.groupBy(window("event_time", "5 minutes"))
.count())'cloudFiles.schemaLocation' must be specified
Solution:
(spark.readStream.format("cloudFiles")
.option("cloudFiles.format", "json")
.option("cloudFiles.schemaLocation", "/path/to/schema")
.load("/data/path"))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"))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 '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;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`;java.lang.OutOfMemoryError: Java heap space
Solutions:
- Increase executor memory
- Reduce data per partition
- Cache strategically
- 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)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)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 Spark Declarative Pipelines was formerly Lakeflow Declarative Pipelines / Delta Live Tables (DLT).
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:
- Check the pipeline event log for failed records (
event_log(TABLE(...))orevent_log('<pipeline-id>')) - Fix source data or adjust expectation
- Change to
DROP ROWif failures are acceptable
Circular dependency detected in pipeline
Solution: Review and remove table dependencies that form cycles.
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")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()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",
){"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]]
}{"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
){"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 is now called AI Search in the docs; error text may use either name.
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 fieldDatabricksError: 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');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.
{"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
| 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 |