CertSafari
    Databricks Certified Data Engineer Professional - October 9 onwards· Lessons

    Domain 8 · Lesson 40/45

    Troubleshooting Databricks errors: Spark UI, logs, query profiles and system tables

    Identify pertinent diagnostic information using Spark UI, cluster logs, system tables, and query profiles to troubleshoot errors.

    18 min read
    2.5% of exam
    12 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Match a failure symptom (task exception, out-of-memory, init failure, slow SQL, cost spike) to the place that holds its evidence
    • Use the Spark UI's failed stage, task failure reasons and stage metrics to find the failing task and see whether skew or spill is involved
    • Read driver stdout, stderr and log4j output, executor logs and cluster event logs, and know which access modes allow each
    • Explain how cluster log delivery and init script logs work, and read cluster termination codes
    • Use a query profile, system.query.history and system.lakeflow run timelines when there is no Spark UI

    Key concept

    Evidence lives where the failure happened — Each layer of a Databricks workload keeps its own record. Compute provisioning writes to the cluster event log, Spark execution to the Spark UI and the driver and executor logs, warehouse and serverless SQL to the query profile, and run outcomes across the account to system tables. Troubleshooting starts by working out which layer failed and opening that layer's record first.

    1.Choosing the diagnostic source from the symptom

    The first question is not what went wrong. It is how far the workload got before it went wrong. A job that fails in a Spark task leaves a failed stage, a task failure reason and a stack trace. A job whose cluster never started leaves none of those, because no Spark application ever ran. That cluster has no Spark UI, no driver log and no task. All you have is the cluster's event log and any init script output it delivered. A slow query on a SQL warehouse has no cluster page at all, so its record is the query profile.

    The Spark UI is the record of a running Spark application. It shows which jobs ran, how long each stage took, how much data moved and where tasks failed. It is built for three symptoms: a workload slower than it used to be, a workload costing more than the data volume justifies, and failures whose error message doesn't name the cause. Everything below the Spark application, such as instance launch, networking and init scripts, is recorded elsewhere.

    Where to look first for each symptom
    SymptomFirst evidence sourceWhat to read there
    Task throws an exception; run ends FAILEDSpark UI, failed job, then failed stageFailure reason per task, then the stack trace in the driver log
    Executor lost or out of memoryCompute Event log, then Spark UI Executors tabResize or spot-loss events; the failed executor's logs
    Cluster never starts; no Spark UI for the runCluster event log and delivered init script logsTermination code, INIT_SCRIPTS_STARTED / INIT_SCRIPTS_FINISHED, script output
    Slow or failed SQL on a warehouse or serverlessQuery profile, found through Query HistoryStatus, error, top operators, time and memory per operator
    Which runs failed, when, and on which computesystem.lakeflow.job_task_run_timelineresult_state, termination_code, compute_ids

    A cost spike on a cluster workload uses the same Spark UI path as a slowdown, starting at the jobs timeline. If the timeline shows failing jobs, long gaps or many small jobs, go to the page for that pattern instead of working through the stages. Cost and slowness usually share a cause, because executors that wait on one straggling task still cost money.

    Checkpoint 1 of 9· Check yourself

    A scheduled job run ends in failure, and the run has no Spark UI. The cluster was terminated before it reached the running state. Where should you look first to find out why?

    Checkpoint 2 of 9· Exam question

    A scheduled job cluster fails during startup, before any tasks run, and the job run shows status FAILED with no Spark UI available for that run. Where should the engineer look first to find the root cause of the failure?

    Sources12

    2.Finding the failed stage and the failing task in the Spark UI

    For a task exception, the Spark UI path is short. Click the failing job in the jobs timeline and scroll down to the failed stage and its failure reason. If the stage only reports a generic error, open the stage through its description link. Further down that page, each task lists why it failed, for example a memory error. That task-level reason is the first fact to write down. The full stack trace for an exception is in the driver log, covered in the next section.

    Removed executors look like failures but often aren't. Autoscaling removes executors on purpose. Spot instance losses mean the cloud provider reclaimed the VMs. Executors running out of memory is the case that is a real fault. To tell them apart, check the compute's Event log first for resize or spot-loss events. If it explains nothing, open the Spark UI Executors tab and pull the logs of the failed executors.

    For a slow stage, the stage page has two checks. Spill statistics appear in the stage details at the top only when the stage spilled. Spill means Spark ran short of execution memory and wrote data to disk, and it most often happens during shuffles. Skew shows up under Summary Metrics. If the Max task duration is 50% or more above the 75th percentile, suspect skew. Streaming uses the same page. Each batch links to its job, the job links to its stages, and the task list shows which executor ran each task, along with shuffle information.

    After you find the outlier task, two more views confirm what is going on. On the Executors tab, the executor that ran the task has its logs and a Thread Dump link. A thread dump is the tool for a specific hanging or slow task. From the job page, Associated SQL Query opens the SQL DAG. Clicking an operator there shows output rows, peak memory and spill size, which tells you which operator produced the oversized partition. A bigger driver does nothing for this, because the slow work runs on an executor.

    Checkpoint 3 of 9· Put it in order

    The jobs timeline for a cluster workload shows several removed executors. Put the investigation steps in the order the guide prescribes.

    1. 1.Pull the logs from the failed executors to look for a real fault such as running out of memory
    2. 2.Note any resize or spot-loss messages; autoscaling is expected and spot loss is the provider reclaiming VMs
    3. 3.If the Event log explains nothing, go back to the Spark UI and open the Executors tab
    4. 4.Open the compute's Event log and look for events explaining the executor loss

    Checkpoint 4 of 9· Exam question

    A Structured Streaming job's micro-batches have started taking roughly eight times longer than usual. In the Spark UI, the engineer opens the Stages tab for the slow batch and finds a stage with a long tail: 199 of 200 tasks finish in under 10 seconds, but one task runs for over 20 minutes and shows a much larger Shuffle Read Size than the others. Which of the following are appropriate next steps to confirm and address this using the Spark UI? (Select all that apply)(Select 3)

    0 of 3 selected

    Sources3456

    3.Driver logs, executor logs and log delivery

    The driver log holds the stack trace. Direct print and log statements from notebooks, jobs and libraries go to the Spark driver logs. The compute's Driver logs tab offers them as three downloadable outputs: standard output, standard error and Log4j logs. When a streaming query never shows a Streaming tab in the Spark UI, an exception stopped it before it started. The stack trace of that exception is in the driver log. The driver log also helps when batches stay stuck in processing or failed instead of reaching Completed batches.

    Executor logs are for tasks that misbehave. Start on the task details page to find which executor ran the task. Then, from the compute page, open the nodes, then the master, choose that worker and read its log4j output.

    Access mode decides who can read these logs. On Standard access mode, only workspace admins can open driver logs, and executor logs are not available. On Dedicated access mode, the dedicated user or group and workspace admins can read both. A troubleshooting plan that depends on executor logs therefore needs Dedicated compute, or an admin to do the reading.

    Log delivery keeps these logs after the compute is gone. You can configure a log delivery location for a compute resource, and both worker and compute logs are written there. This matters most for job clusters that terminate when the run ends. With delivery configured, the logs from a failed run are still available after its cluster has been deleted.

    Checkpoint 5 of 9· Check yourself

    You start a Structured Streaming query on a classic cluster, but the Spark UI never shows a Streaming tab for it. Where is the evidence that explains why?

    Sources75

    4.Cluster event logs, init scripts and termination codes

    If a job cluster fails before any task runs, look in the cluster event log first. The Spark UI has nothing to show, because Spark never started. The event log records the cluster's lifecycle, and when a cluster terminates it records an error code that maps to a cause and a recommended fix. Some failures take a while to show up. A first test compute on a newly deployed workspace can hang for 20 to 30 minutes before its event log reports a network misconfiguration.

    Init script failures leave evidence in two places. The cluster event log records the INIT_SCRIPTS_STARTED and INIT_SCRIPTS_FINISHED events. INIT_SCRIPTS_FINISHED includes execution duration and is logged only for scripts that completed. These events come from one representative node, not every node. The script's own output is in the cluster logs. With log delivery configured, it is written under /<cluster-log-path>/<cluster-id>/init_scripts, in one subdirectory per container.

    Listing delivered init script logs for one cluster from a Unity Catalog volumebash
    databricks fs ls dbfs:/Volumes/<catalog>/<schema>/<volume>/1001-234039-abcde739/init_scripts

    Termination codes separate your problems from the platform's. Some codes point at configuration you control, such as a subnet without free IPs, an instance type the zone can't supply, or a network path that blocks bootstrap. Others are transient faults on the Databricks or cloud-provider side, which usually clear on retry.

    Reading common classic compute termination reasons from the event log
    Event-log evidenceMeaningFirst response
    Instance stuck in INSTANCE_INITIALIZING past the 700-second thresholdVM bootstrap timed out (network, artifact download or provider)Check connectivity to artifact storage and control plane, DNS, firewall rules
    Not enough free addresses in subnetSubnet has too few IPs for the requested instancesDifferent or auto availability zone, larger CIDR, clean up unused interfaces
    CLOUD_PROVIDER_LAUNCH_FAILURECloud provider failed to launch the VMRead aws_error_message; retry, since most of these are transient
    CLUSTER_OPERATION_TIMEOUT (SERVICE_FAULT)Internal operation missed its deadline; not your workloadRetry; contact support with cluster ID and timestamp if it recurs
    METASTORE_DOWN eventsMetastore unreachable, for example through a web application firewallConfirm whether a WAF such as Squid proxy sits in the path

    Checkpoint 6 of 9· Match them up

    Match each piece of cluster event-log evidence from a job cluster that never started to the first response it calls for.

    Tap a term, then the definition that fits it.

    Sources892

    5.Query profiles when there is no Spark UI

    For SQL warehouses and serverless compute, the query profile takes the place of the cluster page. The Query profile is a DAG of operators that shows time spent, rows and memory peak for each. You reach it from Query History, the SQL editor, a notebook attached to a warehouse or serverless compute, the pipeline Query History tab, or the jobs UI for runs on warehouses and serverless. To open it, you need to own the query or hold at least CAN MONITOR on the warehouse that ran it.

    For a failed query, start with the query details panel. It shows the status (Queued, Running, Finished, Failed or Cancelled), the user and compute, the full statement and the wall-clock breakdown into scheduling, optimization with file pruning, and execution. The Top operators panel lists the most expensive operators. From the kebab menu, Open in Spark UI shows the same Databricks SQL query at the task level.

    Here is a worked case. A warehouse query joins a 900 GB fact table to a 50 GB dimension on region_id. The profile shows the shuffle operator taking most of the wall-clock time, heavy spill to disk, and one task on that shuffle stage running far longer than its siblings. A shuffle redistributes rows across executors by key. If one key value holds most of the rows, one partition gets most of the data, and that task spills while the rest finish early. The single outlier task is what points to skew. A sort-merge join chosen because the dimension is too large to broadcast slows every task, but it does not create one straggler. A disabled disk cache or poor pruning would show up on the Scan operator, not on the shuffle.

    Checkpoint 7 of 9· Check yourself

    A teammate clicks a finished query in Query History on a SQL warehouse. When they click See query profile, the panel says "Query profile is not available." What explains this, and how do they get a profile?

    Checkpoint 8 of 9· Exam question

    A data engineer runs a Spark SQL query on a SQL warehouse that joins a 900 GB fact table to a 50 GB dimension table on region_id. The query profile shows an Exchange operator consuming 70% of wall-clock time, with 220 GB of spill (disk) reported and one task running far longer than the others on that shuffle stage. Which diagnosis best matches this query profile evidence?

    Sources10

    6.System tables: which runs failed, when, and on which compute

    System tables answer questions that span many runs, which no single UI page does. The System tables (billing, compute, access, lakeflow) are account-wide Unity Catalog tables of operational history. For troubleshooting, system.lakeflow.job_task_run_timeline has one row per task run, with job_id, run_id, task_key, period_start_time and period_end_time. Its compute_ids array names the job clusters, interactive clusters or SQL warehouses the task used. That cluster ID is the link back to the cluster event log.

    termination_code values that point to a diagnostic source
    termination_codeMeaningWhere to look next
    RUN_EXECUTION_ERRORRun completed with task failuresSpark UI failed stage, then driver log
    CLUSTER_ERRORRun failed due to a cluster errorCluster event log for the ID in compute_ids
    DRIVER_ERRORError communicating with the Spark driverDriver logs and the driver thread dump
    STORAGE_ACCESS_ERRORError accessing customer blob storageStorage credentials and network path
    WORKSPACE_RUN_LIMIT_EXCEEDEDConcurrent active run quota reachedSpread the schedule over a longer window

    These tables hold outcomes and codes. They do not hold log text. For task runs longer than an hour, result_state is filled in only on the row that represents the end of the run. To read what the code actually printed, use the driver log or the delivered cluster logs.

    For SQL, system.query.history plays the same role. A FAILED execution_status comes with an error_message giving the reason. spilled_local_bytes records how much data a statement temporarily wrote to disk, so you can find queries that spill without opening each one. To go from a row to its profile, sign in to the workspace in the row's workspace_id, paste the statement_id into the Statement ID field in Query History, open the query and click See query profile. Only admins can query this table by default.

    Checkpoint 9 of 9· Put it in order

    A query against system.query.history turns up a FAILED statement with a high spilled_local_bytes value. You want to see its operator-level detail. Put the steps for getting from that row to the statement's query profile in order.

    1. 1.Click the name of the query that appears, then click See query profile
    2. 2.Find the row of interest and note its statement_id and workspace_id
    3. 3.Make sure you are signed in to the workspace that matches the row's workspace_id
    4. 4.Click Query History in the workspace sidebar and paste the statement_id into the Statement ID field

    Sources1112

    Sources

    (12)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “The Spark UI shows what the cluster actually did”
      ↩︎ Choosing the diagnostic source from the symptom
      “Jobs or executors fail, and the error message doesn't identify the cause.”
      ↩︎ Choosing the diagnostic source from the symptom
      “A workload costs more than expected for the amount of data it processes.”
      ↩︎ Choosing the diagnostic source from the symptom
    2. 2.
      “Init script start and finish events are captured in cluster event logs. Details are captured in cluster logs.”
      ↩︎ Choosing the diagnostic source from the symptom
      “Cluster event logs do not log init script events for each cluster node; only one node is selected to represent them all.”
      ↩︎ Cluster event logs, init scripts and termination codes
      “the init script logs are written to /<cluster-log-path>/<cluster-id>/init_scripts”
      ↩︎ Cluster event logs, init scripts and termination codes
    3. 3.
      “If you see any failing jobs, click them to open their pages.”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “If you scroll down on this page, you see why each task failed.”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “first check the compute's Event log to see whether there's an explanation for the executor failures”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “Autoscaling: In this case it's expected and not an error.”
      ↩︎ Exam trap 4
      “To find out why your executors are failing, first check the compute's Event log to see whether there's an explanation for the executor failures.”
      ↩︎ Checkpoint
    4. 4.
      “If the Max duration exceeds the 75th percentile by 50% or more, the stage might have skew.”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “Spill is most common during data shuffling.”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “Broadcast joins are never skew-optimized”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “Set spark.sql.shuffle.partitions=auto so that Spark picks the number of shuffle partitions”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “Skew happens when one or a few tasks take much longer than the rest.”
      ↩︎ Prediction
    5. 5.
      “Thread dumps are useful in debugging a specific hanging or slow-running task.”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “where they were executed (on which executors) and shuffle information”
      ↩︎ Finding the failed stage and the failing task in the Spark UI
      “You can drill into the Driver logs to look at the stack trace of the exception.”
      ↩︎ Driver logs, executor logs and log delivery
      “You can choose the worker where the suspicious task was run and then get to the log4j output.”
      ↩︎ Driver logs, executor logs and log delivery
      “Executor logs are not available for compute with Standard access mode.”
      ↩︎ Driver logs, executor logs and log delivery
      “For compute with Standard access mode, only workspace admins can access driver logs.”
      ↩︎ Exam trap 1
    6. 7.
      “The direct print and log statements from your notebooks, jobs, and libraries go to the Spark driver logs.”
      ↩︎ Driver logs, executor logs and log delivery
      “Both worker and compute logs are delivered to the location you specify.”
      ↩︎ Driver logs, executor logs and log delivery
    7. 8.
      “Use the error code from your cluster event log to find the relevant cause and recommended fix.”
      ↩︎ Cluster event logs, init scripts and termination codes
      “The bootstrap timeout is 700 seconds.”
      ↩︎ Cluster event logs, init scripts and termination codes
      “This indicates a problem on the Databricks or cloud-provider side rather than a problem with your workload.”
      ↩︎ Cluster event logs, init scripts and termination codes
      “Use the error code from your cluster event log to find the relevant cause and recommended fix.”
      ↩︎ Key concept
      “Use the error code from your cluster event log to find the relevant cause and recommended fix.”
      ↩︎ Checkpoint
    8. 9.
      “After approximately 20-30 minutes, check your compute event log.”
      ↩︎ Cluster event logs, init scripts and termination codes
    9. 10.
      “you must have at least CAN MONITOR permission on the SQL warehouse that executed the query”
      ↩︎ Query profiles when there is no Spark UI
      “You can access query profiles for jobs run on SQL warehouses and serverless compute.”
      ↩︎ Query profiles when there is no Spark UI
      “Shuffle operations are expensive with regard to resources because they move data between executors on the cluster.”
      ↩︎ Query profiles when there is no Spark UI
      “Click the kebab menu near the top of the page, then click Open in Spark UI.”
      ↩︎ Query profiles when there is no Spark UI
      “A query profile is not available for queries that run from the query cache.”
      ↩︎ Query profiles when there is no Spark UI
      “A query profile is not available for queries that run from the query cache.”
      ↩︎ Exam trap 3
    10. 11.
      “The compute_ids array contains IDs of job clusters, interactive clusters, and SQL warehouses used by the job task”
      ↩︎ System tables: which runs failed, when, and on which compute
      “The run was completed with task failures.”
      ↩︎ System tables: which runs failed, when, and on which compute
      “The compute_ids array contains IDs of job clusters, interactive clusters, and SQL warehouses used by the job task”
      ↩︎ Exam trap 2
    11. 12.
      “FAILED: execution failed with the reason for failure described in the accompanying error message”
      ↩︎ System tables: which runs failed, when, and on which compute
      “In the Statement ID field, paste the statement_id on the record.”
      ↩︎ System tables: which runs failed, when, and on which compute
      “Size of data, in bytes, temporarily written to disk while executing the statement.”
      ↩︎ System tables: which runs failed, when, and on which compute

    Spotted a mistake, or was something unclear? Tell us.