Glue Job Troubleshooter
What this skill does
Diagnoses AWS Glue ETL job failures by walking a seven-category decision
tree that maps the observed symptom (job FAILED, TIMEOUT, RUNNING too
long, or reprocessing bookmarked data) to a specific root cause with
positive evidence. The skill is verdict-driven: it never emits a fix
without first producing the failing probe that confirms the cause.
STRICT output contract
Every invocation MUST emit exactly one diagnostic block per job run
in this shape — no prose before, no commentary after:
TARGET: <job-name>/<run-id> or <job-name> if RunId unknown
VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE
REASON: <1-2 sentences naming the failing category and the probe>
CATEGORY: SCRIPT_EXCEPTION | TIMEOUT_DPU | TIMEOUT_SKEW |
JDBC_VPC | JDBC_CRED | BOOKMARK_STALL | CATALOG_MISSING |
CATALOG_PARTITION | SPARK_OOM | SPARK_STAGE |
DYNAMICFRAME_SCHEMA | DYNAMICFRAME_TYPE | UNKNOWN
EVIDENCE:
- <observed symptom — ErrorMessage, state, duration>
- <failing probe — command and output that confirms the cause>
- <passing probes — categories ruled out>
REMEDIATION:
1. <specific action with CLI command>
2. <verification command after the fix>
A block missing VERDICT, CATEGORY, EVIDENCE, or REMEDIATION is a
contract violation — re-emit the full block. NEVER combine multiple job
runs in a single block; one run per block.
Quick start
- Start with
get-job-run — not the script. ErrorMessage and
ExecutionTime narrow the category before you open the script. A short
ExecutionTime with a Python traceback points to SCRIPT_EXCEPTION; a
timeout at the configured Timeout minutes points to TIMEOUT_*; a long
run with no traceback points to skew or DPU starvation.
- Bookmark problems hide in
get-job-bookmark. If a job that should
skip old data is reprocessing it, the bookmark is stale, missing, or
tracking the wrong partition column. The bookmark is per-job.
- JDBC failures are almost never Glue. They are VPC security group,
subnet route table, or self-referencing rule problems on the Glue
connection. Verify connection SG, database SG, and route table before
assuming a Glue bug.
- Spark OOM is a skew or shuffling problem, not a memory problem.
Throwing more DPU at an OOM rarely fixes it; the fix is salting the
skewed key, repartitioning before a wide transform, or moving to
G.2X only if the executor genuinely needs more heap.
- Glue version matters. 2.0 = Spark 2.4 / Python 3.7; 3.0 = Spark
3.1 / Python 3.9; 4.0 = Spark 3.3 / Python 3.10. A script that ran on
2.0 may fail on 4.0 because of Spark SQL strictness, PyArrow
incompatibility, or removed DataFrameWriter options.
Mindset
A Glue job run is a Spark application wrapped in an AWS-managed control
plane. Most failures are not Glue bugs — they are configuration drift
between the job, the Data Catalog, the VPC, and the source data. The
skill's job is to find the layer that drifted. The fastest path to root
cause is to read get-job-run first, then narrow to the category that
matches the symptom signature, then run the category-specific probe
before opening the script.
Quick reference — verdict thresholds
| Observation |
Verdict |
Category |
ErrorMessage contains Python Traceback |
ROOT_CAUSE_FOUND |
SCRIPT_EXCEPTION |
ExecutionTime == Timeout, no traceback |
ROOT_CAUSE_FOUND |
TIMEOUT_DPU / TIMEOUT_SKEW |
| Spark UI: one task reads 100x median bytes |
ROOT_CAUSE_FOUND |
TIMEOUT_SKEW |
ErrorMessage mentions Connection refused / VPC |
ROOT_CAUSE_FOUND |
JDBC_VPC |
ErrorMessage mentions Access denied / auth failed |
ROOT_CAUSE_FOUND |
JDBC_CRED |
Source grew but get-job-bookmark shows old marker |
ROOT_CAUSE_FOUND |
BOOKMARK_STALL |
EntityNotFoundException: Table not found |
ROOT_CAUSE_FOUND |
CATALOG_MISSING |
ErrorMessage mentions partition + not found |
ROOT_CAUSE_FOUND |
CATALOG_PARTITION |
Spark UI executor: OOM / Container killed by YARN |
ROOT_CAUSE_FOUND |
SPARK_OOM |
| Spark UI: failed stage with one slow task |
ROOT_CAUSE_FOUND |
SPARK_STAGE / TIMEOUT_SKEW |
ResolveChoice / apply_mapping schema errors |
ROOT_CAUSE_FOUND |
DYNAMICFRAME_SCHEMA |
ExecutionTime long but job succeeded, no probe run |
NEED_MORE_INFO |
(need Spark UI) |
| AWS Health event for Glue in region |
ESCALATE |
(AWS-side incident) |
Pre-flight: data gate (run before any diagnosis)
Glue diagnosis requires three data sources: job-run metadata (state,
ErrorMessage, ExecutionTime, configuration), CloudWatch Logs excerpt for
the failing run, and — for performance/skew diagnoses — the Spark UI
event log exported to S3.
Data-gate CLI (get-job-run, get-job-runs, CloudWatch Logs, bookmark state, Spark UI event log) moved to references/diagnostic-commands.md — load on demand.
Data-quality short-circuits
| Condition |
Effect on diagnosis |
get-job-run returns RunId not found |
Job never started under that id; verify via get-job-runs. |
ErrorMessage is No ErrorReason but State=FAILED |
Need CloudWatch Logs to surface the exception. Emit NEED_MORE_INFO with the log-fetch step. |
| CloudWatch log group missing |
Logging disabled (--enable-continuous-cloudwatch-log false). Cannot diagnose script-level failures. NEED_MORE_INFO. |
| Spark UI not enabled |
Cannot diagnose skew / OOM / stage failures with evidence. NEED_MORE_INFO; recommend --enable-spark-ui and --spark-event-logs-path for future runs. |
get-job-bookmark returns {} |
Bookmark reset or never written. Reprocessing is expected, not a bug. |
Job still RUNNING (not FAILED) |
Diagnose as TIMEOUT_* candidate; do NOT wait for failure if past SLA. |
When ExecutionTime and CloudWatch Logs disagree, trust CloudWatch for
the failure moment and get-job-run for overall duration. The
ExecutionTime counts the control-plane wrapper; the Spark application
may have failed earlier.
Process — Diagnostic decision tree (apply in order)
Step 0: Non-obvious behaviours that change the diagnosis
Step 0 non-obvious behaviours moved to references/advanced-patterns.md — load on demand.
Step 1: Job failure (Python script exceptions)
Signature: ErrorMessage contains Traceback, OR short
ExecutionTime (< 5 min) with State=FAILED.
Failing probe: CloudWatch Logs for the run, filtered to Traceback.
Probe: references/diagnostic-commands.md — Step 1 Traceback log filter.
| Exception in trace |
Root cause |
Fix |
KeyError: '<column>' |
Schema changed since last crawl |
Re-crawl; or fix script to tolerate missing column. |
AttributeError: 'NoneType'... |
DataFrame API on None (read returned empty) |
Check source S3 path; check partition filter. |
ImportError: No module named '<pkg>' |
External Python package not installed |
Add --additional-python-modules (Glue 3.0+). |
AnalysisException: Path does not exist |
S3 source path wrong or empty |
Verify s3:// prefix; check source crawler. |
SparkUpgradeException (date parsing) |
Glue version calendar change |
--conf spark.sql.legacy.timeParserPolicy=LEGACY. |
Py4JJavaError (wrapping Java) |
Spark internal — read nested cause |
Surface nested Java stack; route to Step 6. |
AnalysisException: cannot resolve '<col>' |
Typo or case-sensitivity |
Glue 4.0 is case-sensitive; quote column names. |
Passing probes: ExecutionTime < Timeout (not timeout category); no
"Connection refused" (not JDBC); no YARN kill (not OOM).
Step 2: Job timeout (DPU capacity vs long-running transform)
Signature: ExecutionTime == Timeout (±1 min), State=TIMEOUT
or FAILED, no Python traceback.
Failing probe: compare duration to Timeout; pull Spark UI stage
summary for task progression.
jq '{state: .JobRun.State, exec: .JobRun.ExecutionTime,
timeout: .JobRun.Timeout, workers: .JobRun.NumberOfWorkers,
workerType: .JobRun.WorkerType}' job-run.json
| Observation |
Root cause |
Fix |
All tasks slow; NumberOfWorkers < 5 |
DPU-starved |
Raise NumberOfWorkers (min 5 for prod ETL). |
| One task running 50x median |
Data skew |
Salt the skewed key; repartition before wide transform. |
Many tasks stuck on S3 LIST/HEAD |
Too many small files |
Compact source; --conf spark.sql.sources.partitionOverwriteMode=dynamic. |
from_catalog slow, no partition pushdown |
Full scan |
Pass push_down_predicate='year=2025 and month>=01'. |
| JDBC read, no partition column |
Single-threaded JDBC |
Add hashfield / hashexpression predicate. |
G.1X, executor heap exhausted |
Heap pressure |
Move to G.2X or tune --executor-memory. |
Long-running Python UDF in map/flatMap |
UDF serial bottleneck |
Replace with native Spark SQL; broadcast hot data. |
Step 3: JDBC connection errors (VPC, subnet, security group)
Signature: ErrorMessage mentions Connection refused, timed out, VPC configuration, Network interface, ENI, or Could not connect.
Failing probe: verify Glue connection's SG, subnet route table, and
the database SG ingress.
Probe: references/diagnostic-commands.md — Step 3 connection SG / subnet / DB SG / route table.
| Missing config |
Symptom |
Fix |
| DB SG lacks ingress from Glue SG on db port (5432/3306) |
Connection refused / timed out |
Add inbound: source = Glue SG, port = db port. |
| Glue SG lacks egress to DB |
timed out (egress blocked) |
Add outbound: dest = DB SG / CIDR, port = db port. |
| Glue SG lacks self-referencing rule |
Intermittent ENI setup fails |
Add inbound: source = Glue SG itself, all ports. |
| Subnet route table missing path to DB subnet |
timed out |
Add route via TGW / peering / LPG. |
| Glue subnet in different AZ than single-AZ DB |
Connection refused |
Use a Glue connection subnet in the DB's AZ. |
| NACL stateful mismatch |
Intermittent |
NACLs are stateless; check in+out on both subnets. |
| Glue connection points to deleted subnet |
ENI provisioning fails |
Recreate connection with current subnet. |
Passing probes: run nc -vz <db-host> <port> from a Glue dev
endpoint or EC2 in the same subnet. If nc succeeds, the path is clear
and the issue is authentication — route to Step "JDBC credentials"
(JDBC_CRED) and check the connection's JDBC URL / Secrets Manager
reference.
Step 4: Job bookmark errors (not advancing, reprocessing data)
Signature: source S3 prefix grew, but job reprocesses files already
run. get-job-bookmark shows old or empty marker.
Failing probe:
aws glue get-job-bookmark --job-name nightly-sales-aggregation \
--run-id $RUN_ID --output json
# Inspect: bookmark["JobBookmarks"]["Attempt"],
# "Args" / "Paths" / "partitionKeys" structure
| Bookmark observation |
Root cause |
Fix |
Returns {} |
Bookmark disabled or reset |
--job-bookmark-option=enable; or accept reprocess if disabled intentionally. |
partitionKeys present but source path layout changed |
Layout drift |
reset-job-bookmark; update partitionKeys in script. |
Attempt count > 1 across runs |
Bookmark write failing |
Add glue:UpdateJobBookmark to job role. |
Source has nested partitions not in partitionKeys |
Job reads all sub-partitions |
Recrawl; update partitionKeys. |
| Same S3 key reprocessed |
File overwritten in place |
Glue bookmarks by key — overwritten files always reprocess. Design for appends. |
| KMS-encrypted bookmark fails to read |
Role lacks kms:Decrypt on bookmark CMK |
Add KMS decrypt to job role. |
| Glue 2.0 → 3.0+ upgrade, bookmark unreadable |
Bookmark schema changed |
reset-job-bookmark once post-upgrade; accept one reprocess. |
Passing probes: IAM policy simulator on the job's role for
glue:GetJobBookmark and glue:UpdateJobBookmark. Both MUST be Allow.
Step 5: Data Catalog errors (table / partition not found)
Signature: ErrorMessage mentions EntityNotFoundException,
Table not found, Database not found, or Partition not found.
Failing probe:
aws glue get-table --database-name analytics_prod \
--name sales_raw --output json
aws glue get-partitions --database-name analytics_prod \
--table-name sales_raw --output json
aws glue get-database --name analytics_prod --output json
| Probe result |
Root cause |
Fix |
get-table returns EntityNotFoundException |
Table missing |
Re-run crawler; or fix job table name. |
| Table exists but in a different database |
Wrong database_name |
Fix script; database name is case-sensitive. |
get-partitions empty |
Crawler never ran on partitions |
Re-crawl; or MSCK REPAIR TABLE via Athena. |
| Partition exists but job can't see it |
Role lacks glue:GetPartition |
Add glue:GetPartition(s) to job role. |
from_catalog with stale schema |
Catalog schema != S3 data |
Re-crawl; or additional_options={"useCatalogSchema": False}. |
| Cross-account catalog access |
Role lacks cross-account glue:* |
Add resource-account IAM; use catalog ARN. |
| Lake Formation tag blocks read |
LF DESCRIBE missing |
Grant LF DESCRIBE on table to job role. |
Step 6: Spark errors (executor OOM, stage failures, data skew)
Signature: ErrorMessage mentions OutOfMemoryError, Container killed by YARN, Java heap space, GC overhead limit, or stage
failure with Lost task retries.
Failing probe: Spark UI event log — identify the failed stage, task
attempt counts, and executor memory metrics.
Probe: references/diagnostic-commands.md — Step 6 Spark UI event log retrieval.
| Spark symptom |
Root cause |
Fix |
| One task reads 100x median bytes |
Data skew |
Salt the skewed key: df.withColumn("salt", (rand()*10).cast("int")). |
Container killed by YARN...memory limits |
Executor OOM |
G.1X → G.2X; or reduce spark.sql.shuffle.partitions default. |
| Stage retries exhausted (4 attempts) |
Speculative task failures |
Inspect task stack; often OOM or bad input row. |
GC overhead limit exceeded |
Many small objects / UDF churn |
Replace PyRDD UDFs with Spark SQL; broadcast small DFs. |
| Long pause before stage starts |
Shuffle write bottleneck |
Raise spark.sql.shuffle.partitions (200 → 1000+ for TB). |
| Broadcast join OOM |
Broadcast hash table too large |
Lower spark.sql.autoBroadcastJoinThreshold (default 10 MB). |
Python worker OOM (map/flatMap) |
UDF returning huge objects |
Paginate; or applyInPandas with chunking. |
Passing probes: source volume consistent with previous successful
runs; if so, skew is the new factor.
Step 7: DynamicFrame errors (schema mismatch, type coercion)
Signature: log mentions ResolveChoice, apply_mapping,
Cannot coerce, or Category="DYNAMICFRAME".
Failing probe:
aws glue get-table --database-name analytics_prod \
--name sales_raw --output json | jq '.Table.StorageDescriptor.Columns'
| Symptom |
Root cause |
Fix |
ResolveChoice throws CONFlict |
Multiple types across partitions |
resolve_choice(spec=...) with explicit cast:double before joins. |
apply_mapping fails on missing column |
Schema drifted |
Re-crawl; or from_catalog(additional_options={"useCatalogSchema": False}). |
Cannot coerce type string to int |
Mixed types |
Cast via to_number in Spark SQL; or DynamicFrame.unnest(). |
DropField errors on nested struct |
Path doesn't match |
Inspect actual nested path with printSchema(). |
| Joins produce unexpected nulls |
ResolveChoice not called before join |
resolve_choice on both sides before join. |
SparkSession vs GlueContext mismatch |
Glue 4.0 stricter |
Use DynamicFrame for catalog reads; convert to DF only when needed. |
Passing probes: script ran unchanged on prior successful runs; if
so, the source schema changed (crawler drift).
Step 8: AWS-side incident escalation
If AWS Health shows an active Glue incident in the job's region during
the run window, emit ESCALATE with the AWS Health event ARN. Do NOT
continue diagnosing script-level causes when the platform is degraded.
aws health describe-events \
--filter eventStatusCodes=OPEN,services=GLUE \
--region us-east-1 --output json
Step 9: Final verdict
- If a single category's failing probe produced positive evidence,
emit ROOT_CAUSE_FOUND with that CATEGORY.
- If two categories overlap (e.g., SCRIPT_EXCEPTION with underlying
SPARK_OOM), pick the most-specific category (SPARK_OOM) and note
the script layer in EVIDENCE.
- If a probe requires operator input (Spark UI not enabled, log group
missing), emit NEED_MORE_INFO with the data gap.
- If AWS Health shows an active Glue incident, emit ESCALATE.
Output format — worked examples
Worked example — script exception
TARGET: nightly-sales-aggregation/jr_abc123def456
VERDICT: ROOT_CAUSE_FOUND
REASON: CloudWatch Logs for the run contain an AttributeError on
line 47 of the script — from_catalog returned None when the table
was empty. ExecutionTime was 42s.
CATEGORY: SCRIPT_EXCEPTION
EVIDENCE:
- State=FAILED, ExecutionTime=42, ErrorMessage="No ErrorReason"
- Failing probe:
aws logs filter-log-events --log-group-name /aws-glue/jobs/output
--log-stream-name jr_abc123def456 --filter-pattern "Traceback"
→ AttributeError: 'NoneType' object has no attribute '_jvc'
at line 47 (df.withColumn('revenue', col('price')*col('qty')))
- Passing probes: ExecutionTime=42 < Timeout=60 (not TIMEOUT_*);
no 'Connection refused' (not JDBC_VPC); no YARN kill (not OOM)
REMEDIATION:
1. Re-crawl to confirm data is present in analytics_prod.sales_raw:
aws glue start-crawler --name sales-raw-crawler
2. Add a None guard in the script before line 47:
if df is None or df.rdd.isEmpty():
logger.warning("source empty; skipping")
return
df = df.withColumn("revenue", col("price") * col("qty"))
3. Re-run with bookmark=enable to skip processed partitions:
aws glue start-job-run --job-name nightly-sales-aggregation \
--arguments '{"--job-bookmark-option":"enable"}'
Worked example — JDBC VPC security group
Full JDBC VPC security-group example moved to references/worked-examples.md — load on demand.
Worked example — bookmark stall
Full bookmark-stall example moved to references/worked-examples.md — load on demand.
Worked example — Spark OOM with data skew
Full Spark OOM data-skew example moved to references/worked-examples.md — load on demand.
Worked example — NEED_MORE_INFO
Full NEED_MORE_INFO example moved to references/worked-examples.md — load on demand.
Anti-Patterns — NEVER do these things
- NEVER recommend raising
NumberOfWorkers to fix an OOM without
checking the Spark UI skew ratio. DPU-scale rarely fixes data skew;
the hot key stays hot. Check max/median task bytes; if > 10x, skew
is the cause and salting is the fix.
- NEVER recommend
reset-job-bookmark as a first response to
reprocessing complaints. Reset discards the marker and forces a
one-time full reprocess. First inspect the existing bookmark; reset
only when the source layout actually changed.
- NEVER assume a Glue JDBC connection failure is a Glue bug. Glue's
ENI is the network interface; the database SG ingress is the most
common cause. Verify SG, subnet route, and self-referencing rule
before opening an AWS Support ticket.
- NEVER upgrade a Glue 2.0 job to 3.0 / 4.0 in production without
running it in dev first. The Spark version change (2.4 → 3.1 → 3.3)
tightens SQL strictness, changes the date/time calendar, and may
break PyArrow/pandas UDFs.
- NEVER diagnose "table not found" without checking the database name
and IAM role permissions.
EntityNotFoundException fires identically
when the table doesn't exist AND when the role lacks glue:GetTable.
- NEVER cancel a long-running RUNNING job without first checking the
Spark UI for genuine stuckness vs normal progress. Cancelling wastes
all work and obscures diagnostic data.
- NEVER edit the script and re-run without reproducing the failure in
dev. The fix-and-pray loop on prod data masks whether the fix worked.
- NEVER rely solely on
ErrorMessage. Glue's control plane summary is
frequently No ErrorReason even when the script threw. Always check
CloudWatch Logs.
- NEVER recommend
G.2X as a blanket OOM fix. G.2X doubles cost per
DPU; if the OOM is skew, the fix is salting (free).
- NEVER skip the IAM permission check when diagnosing Data Catalog
errors. The role MUST have
glue:GetTable, glue:GetPartition(s),
glue:GetDatabase, and (Lake Formation) the LF DESCRIBE grant.
Quick navigation
| You want to... |
Jump to |
| Diagnose a Python traceback |
Step 1 — Script exception |
| Diagnose a job that ran to Timeout |
Step 2 — Job timeout |
| Diagnose a JDBC connection failure |
Step 3 — JDBC connection |
| Diagnose reprocessing data |
Step 4 — Bookmark stall |
| Diagnose "table not found" |
Step 5 — Data Catalog |
| Diagnose Spark OOM / skew |
Step 6 — Spark errors |
| Diagnose ResolveChoice errors |
Step 7 — DynamicFrame |
| Handle missing logs / Spark UI |
Pre-flight data gate |
| Handle AWS Health incident |
Step 8 — Escalate |
| Look up Glue version / worker types |
references/glue-runtime-reference.md |
Expert heuristic — the 60-second triage
60-second triage heuristic moved to references/advanced-patterns.md — load on demand.
Pre-flight safety checks (run before any remediation CLI)
Verdict semantics
| Verdict |
When to emit |
Position in workflow |
ROOT_CAUSE_FOUND |
A failing probe produced positive evidence for one category. |
Primary — terminal for actionable findings. |
NEED_MORE_INFO |
A required probe is unavailable (no logs, no Spark UI, run still RUNNING). |
Pre-decision — emit with the specific data gap. |
ESCALATE |
AWS Health shows an active Glue incident in the region during the run. |
Pre-decision — surface event ARN; do NOT diagnose script-level causes. |
Recent AWS features (2024-2026)
Recent AWS feature notes moved to references/advanced-patterns.md — load on demand.
References (load on demand)
- references/worked-examples.md — secondary worked examples (JDBC VPC SG, bookmark stall, Spark OOM skew, NEED_MORE_INFO).
- references/advanced-patterns.md — Step 0 non-obvious behaviours, the 60-second triage heuristic, recent AWS features.
- references/diagnostic-commands.md — pre-flight data-gate CLI and per-step probe commands (Steps 1, 3, 6).
- references/glue-runtime-reference.md — Glue version / worker type / runtime mapping.
Domain
AWS CloudOps / Analytics — Glue ETL job failure diagnosis.
AWS documentation
1---2name: glue-job-troubleshooter3description: Diagnoses AWS Glue ETL job failures through a seven-category diagnostic tree — Python script exceptions (KeyError, AttributeError, import errors), job timeout (insufficient DPU, long-running transforms, skewed reads), JDBC connection errors (VPC security group, subnet, network ACL, self-referencing rule), job bookmark errors (not advancing, reprocessing data, partition format change), Data Catalog errors (table not found, partition not found, stale crawler), Spark errors (executor OOM, stage failures, data skew, GC overhead), and DynamicFrame errors (schema mismatch, type coercion). Reads get-job-run ErrorMessage and ExecutionTime, CloudWatch logs (/aws-glue/jobs/), Spark UI exported to S3, and get-job-bookmark state. Emits ROOT_CAUSE_FOUND with the failing probe and positive evidence, NEED_MORE_INFO when a probe requires operator input, or ESCALATE for AWS-side incidents. Use when a Glue job shows FAILED, TIMEOUT, RUNNING past expected duration, or is reprocessing data the bookmark should have skipped.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline classification works from a pasted job-run ErrorMessage, CloudWatch Logs excerpt, or Spark stage failure summary. Live-account diagnosis uses aws glue get-job-run, get-job-runs, get-job-bookmark, get-connection, aws logs filter-log-events on /aws-glue/jobs, aws s3 cp for Spark UI event logs, aws glue get-table and get-partitions for catalog validation, and aws ec2 describe-security-groups /...6metadata:7 source: https://skillmd.com/skills/jhkchan/glue-job-troubleshooter8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '2'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Analytics15 task_type: troubleshoot16 skill_class: capability17 lifecycle_status: active18 verdict_shape: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE19 when_to_use: Diagnosing an AWS Glue ETL job that FAILED, hit TIMEOUT, is RUNNING past its expected duration, is reprocessing data the bookmark should have skipped, is throwing Python exceptions, is unable to reach a JDBC source in a VPC, is reporting Spark executor OOM or stage failures, or is surfacing Data Catalog "table not found" / "partition not found" errors.20 when_not_to_use: Glue Data Quality rule evaluation (use the Data Quality service directly), AWS Lake Formation permission errors (use Lake Formation admin tooling), Glue Studio notebook interactive development (not a job-run diagnosis), or Glue crawler schema inference tuning (use a crawler classification specialist). This skill diagnoses job-run failures, not data quality or governance.21 activation_triggers: Glue job failed, Glue job timeout, Glue bookmark not advancing, Glue reprocessing data, Glue JDBC connection error, Glue Spark OOM, Glue stage failure, Glue table not found, Glue partition not found, DynamicFrame schema mismatch, Glue DPU capacity, Glue job RUNNING too long, Glue version 2.0 vs 3.0 vs 4.0, diagnose Glue ETL failure, Spark UI Glue22 invocation_schema: 'Input: either (a) a Glue JobName + RunId + live-account context, (b) a pasted ErrorMessage from glue:get-job-run, OR (c) a CloudWatch Logs / Spark stage failure excerpt. Output: a deterministic TARGET / VERDICT / REASON / CATEGORY / EVIDENCE / REMEDIATION block per job run, where VERDICT ∈ {ROOT_CAUSE_FOUND, NEED_MORE_INFO, ESCALATE} and CATEGORY ∈ {SCRIPT_EXCEPTION, TIMEOUT_DPU, TIMEOUT_SKEW, JDBC_VPC, JDBC_CRED, BOOKMARK_STALL, CATALOG_MISSING, CATALOG_PARTITION, SPARK_OOM, SPARK_STAGE, DYNAMICFRAME_SCHEMA, DYNAMICFRAME_TYPE, UNKNOWN}.'23 invocation_example: "# Minimal valid input (offline classification from ErrorMessage):\nJobName: nightly-sales-aggregation\nRunId: jr_abc123def456\nState: FAILED\nErrorMessage: \"Traceback (most recent call last):\n File \\\"tmp/script.py\\\", line 47, in <module>\n df = df.withColumn('revenue', col('price') * col('qty'))\n ... AttributeError: 'NoneType' object has no attribute '_jvc'\"\nExecutionTime: 42\nGlueVersion: 4.0\nWorkerType: G.1X\nNumberOfWorkers: 5\nEmit the standard diagnostic block (TARGET, VERDICT, REASON,\nCATEGORY, EVIDENCE, REMEDIATION)."24 version: 0.1.025 author: Jacky Chan — AWS Community Builder26 keywords: AWS Glue, Glue ETL, Glue job failure, Glue job timeout, Glue bookmark, DynamicFrame, Spark OOM, data skew, JDBC connection, Glue Data Catalog, Glue version 4.0, DPU capacity, Glue Spark UI, CloudWatch logs, Glue connection, crawler, partition pruning, Python shell job, Ray job, Analytics27 tags: glue, analytics, etl, troubleshoot, spark, data-catalog28---2930# Glue Job Troubleshooter3132## What this skill does3334Diagnoses AWS Glue ETL job failures by walking a seven-category decision35tree that maps the observed symptom (job FAILED, TIMEOUT, RUNNING too36long, or reprocessing bookmarked data) to a specific root cause with37positive evidence. The skill is verdict-driven: it never emits a fix38without first producing the failing probe that confirms the cause.3940## STRICT output contract4142Every invocation MUST emit exactly one diagnostic block per job run43in this shape — no prose before, no commentary after:4445```text46TARGET: <job-name>/<run-id> or <job-name> if RunId unknown47VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE48REASON: <1-2 sentences naming the failing category and the probe>49CATEGORY: SCRIPT_EXCEPTION | TIMEOUT_DPU | TIMEOUT_SKEW |50 JDBC_VPC | JDBC_CRED | BOOKMARK_STALL | CATALOG_MISSING |51 CATALOG_PARTITION | SPARK_OOM | SPARK_STAGE |52 DYNAMICFRAME_SCHEMA | DYNAMICFRAME_TYPE | UNKNOWN53EVIDENCE:54 - <observed symptom — ErrorMessage, state, duration>55 - <failing probe — command and output that confirms the cause>56 - <passing probes — categories ruled out>57REMEDIATION:58 1. <specific action with CLI command>59 2. <verification command after the fix>60```6162A block missing VERDICT, CATEGORY, EVIDENCE, or REMEDIATION is a63contract violation — re-emit the full block. NEVER combine multiple job64runs in a single block; one run per block.6566## Quick start6768- **Start with `get-job-run` — not the script.** ErrorMessage and69 ExecutionTime narrow the category before you open the script. A short70 ExecutionTime with a Python traceback points to SCRIPT_EXCEPTION; a71 timeout at the configured Timeout minutes points to TIMEOUT_*; a long72 run with no traceback points to skew or DPU starvation.73- **Bookmark problems hide in `get-job-bookmark`.** If a job that should74 skip old data is reprocessing it, the bookmark is stale, missing, or75 tracking the wrong partition column. The bookmark is per-job.76- **JDBC failures are almost never Glue.** They are VPC security group,77 subnet route table, or self-referencing rule problems on the Glue78 connection. Verify connection SG, database SG, and route table before79 assuming a Glue bug.80- **Spark OOM is a skew or shuffling problem, not a memory problem.**81 Throwing more DPU at an OOM rarely fixes it; the fix is salting the82 skewed key, repartitioning before a wide transform, or moving to83 `G.2X` only if the executor genuinely needs more heap.84- **Glue version matters.** 2.0 = Spark 2.4 / Python 3.7; 3.0 = Spark85 3.1 / Python 3.9; 4.0 = Spark 3.3 / Python 3.10. A script that ran on86 2.0 may fail on 4.0 because of Spark SQL strictness, PyArrow87 incompatibility, or removed DataFrameWriter options.8889## Mindset9091A Glue job run is a Spark application wrapped in an AWS-managed control92plane. Most failures are not Glue bugs — they are configuration drift93between the job, the Data Catalog, the VPC, and the source data. The94skill's job is to find the layer that drifted. The fastest path to root95cause is to read `get-job-run` first, then narrow to the category that96matches the symptom signature, then run the category-specific probe97before opening the script.9899## Quick reference — verdict thresholds100101| Observation | Verdict | Category |102|---|---|---|103| `ErrorMessage` contains Python `Traceback` | **ROOT_CAUSE_FOUND** | SCRIPT_EXCEPTION |104| `ExecutionTime` == `Timeout`, no traceback | **ROOT_CAUSE_FOUND** | TIMEOUT_DPU / TIMEOUT_SKEW |105| Spark UI: one task reads 100x median bytes | **ROOT_CAUSE_FOUND** | TIMEOUT_SKEW |106| `ErrorMessage` mentions `Connection refused` / `VPC` | **ROOT_CAUSE_FOUND** | JDBC_VPC |107| `ErrorMessage` mentions `Access denied` / `auth failed` | **ROOT_CAUSE_FOUND** | JDBC_CRED |108| Source grew but `get-job-bookmark` shows old marker | **ROOT_CAUSE_FOUND** | BOOKMARK_STALL |109| `EntityNotFoundException: Table not found` | **ROOT_CAUSE_FOUND** | CATALOG_MISSING |110| `ErrorMessage` mentions `partition` + `not found` | **ROOT_CAUSE_FOUND** | CATALOG_PARTITION |111| Spark UI executor: `OOM` / `Container killed by YARN` | **ROOT_CAUSE_FOUND** | SPARK_OOM |112| Spark UI: failed stage with one slow task | **ROOT_CAUSE_FOUND** | SPARK_STAGE / TIMEOUT_SKEW |113| `ResolveChoice` / `apply_mapping` schema errors | **ROOT_CAUSE_FOUND** | DYNAMICFRAME_SCHEMA |114| `ExecutionTime` long but job succeeded, no probe run | **NEED_MORE_INFO** | (need Spark UI) |115| AWS Health event for Glue in region | **ESCALATE** | (AWS-side incident) |116117## Pre-flight: data gate (run before any diagnosis)118119Glue diagnosis requires three data sources: job-run metadata (state,120ErrorMessage, ExecutionTime, configuration), CloudWatch Logs excerpt for121the failing run, and — for performance/skew diagnoses — the Spark UI122event log exported to S3.123124Data-gate CLI (get-job-run, get-job-runs, CloudWatch Logs, bookmark state, Spark UI event log) moved to [references/diagnostic-commands.md](references/diagnostic-commands.md) — load on demand.125126### Data-quality short-circuits127128| Condition | Effect on diagnosis |129|---|---|130| `get-job-run` returns `RunId not found` | Job never started under that id; verify via `get-job-runs`. |131| `ErrorMessage` is `No ErrorReason` but `State=FAILED` | Need CloudWatch Logs to surface the exception. Emit NEED_MORE_INFO with the log-fetch step. |132| CloudWatch log group missing | Logging disabled (`--enable-continuous-cloudwatch-log false`). Cannot diagnose script-level failures. NEED_MORE_INFO. |133| Spark UI not enabled | Cannot diagnose skew / OOM / stage failures with evidence. NEED_MORE_INFO; recommend `--enable-spark-ui` and `--spark-event-logs-path` for future runs. |134| `get-job-bookmark` returns `{}` | Bookmark reset or never written. Reprocessing is expected, not a bug. |135| Job still `RUNNING` (not FAILED) | Diagnose as TIMEOUT_* candidate; do NOT wait for failure if past SLA. |136137When `ExecutionTime` and CloudWatch Logs disagree, trust CloudWatch for138the failure moment and `get-job-run` for overall duration. The139ExecutionTime counts the control-plane wrapper; the Spark application140may have failed earlier.141142## Process — Diagnostic decision tree (apply in order)143144### Step 0: Non-obvious behaviours that change the diagnosis145146Step 0 non-obvious behaviours moved to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.147148### Step 1: Job failure (Python script exceptions)149150**Signature:** `ErrorMessage` contains `Traceback`, OR short151`ExecutionTime` (< 5 min) with `State=FAILED`.152153**Failing probe:** CloudWatch Logs for the run, filtered to `Traceback`.154155Probe: [references/diagnostic-commands.md](references/diagnostic-commands.md) — Step 1 Traceback log filter.156157| Exception in trace | Root cause | Fix |158|---|---|---|159| `KeyError: '<column>'` | Schema changed since last crawl | Re-crawl; or fix script to tolerate missing column. |160| `AttributeError: 'NoneType'...` | DataFrame API on None (read returned empty) | Check source S3 path; check partition filter. |161| `ImportError: No module named '<pkg>'` | External Python package not installed | Add `--additional-python-modules` (Glue 3.0+). |162| `AnalysisException: Path does not exist` | S3 source path wrong or empty | Verify `s3://` prefix; check source crawler. |163| `SparkUpgradeException` (date parsing) | Glue version calendar change | `--conf spark.sql.legacy.timeParserPolicy=LEGACY`. |164| `Py4JJavaError` (wrapping Java) | Spark internal — read nested cause | Surface nested Java stack; route to Step 6. |165| `AnalysisException: cannot resolve '<col>'` | Typo or case-sensitivity | Glue 4.0 is case-sensitive; quote column names. |166167**Passing probes:** `ExecutionTime < Timeout` (not timeout category); no168"Connection refused" (not JDBC); no YARN kill (not OOM).169170### Step 2: Job timeout (DPU capacity vs long-running transform)171172**Signature:** `ExecutionTime` == `Timeout` (±1 min), `State=TIMEOUT`173or `FAILED`, no Python traceback.174175**Failing probe:** compare duration to `Timeout`; pull Spark UI stage176summary for task progression.177178```bash179jq '{state: .JobRun.State, exec: .JobRun.ExecutionTime,180 timeout: .JobRun.Timeout, workers: .JobRun.NumberOfWorkers,181 workerType: .JobRun.WorkerType}' job-run.json182```183184| Observation | Root cause | Fix |185|---|---|---|186| All tasks slow; `NumberOfWorkers` < 5 | DPU-starved | Raise `NumberOfWorkers` (min 5 for prod ETL). |187| One task running 50x median | Data skew | Salt the skewed key; repartition before wide transform. |188| Many tasks stuck on S3 `LIST`/`HEAD` | Too many small files | Compact source; `--conf spark.sql.sources.partitionOverwriteMode=dynamic`. |189| `from_catalog` slow, no partition pushdown | Full scan | Pass `push_down_predicate='year=2025 and month>=01'`. |190| JDBC read, no partition column | Single-threaded JDBC | Add `hashfield` / `hashexpression` predicate. |191| `G.1X`, executor heap exhausted | Heap pressure | Move to `G.2X` or tune `--executor-memory`. |192| Long-running Python UDF in `map`/`flatMap` | UDF serial bottleneck | Replace with native Spark SQL; broadcast hot data. |193194### Step 3: JDBC connection errors (VPC, subnet, security group)195196**Signature:** `ErrorMessage` mentions `Connection refused`, `timed197out`, `VPC configuration`, `Network interface`, `ENI`, or `Could not198connect`.199200**Failing probe:** verify Glue connection's SG, subnet route table, and201the database SG ingress.202203Probe: [references/diagnostic-commands.md](references/diagnostic-commands.md) — Step 3 connection SG / subnet / DB SG / route table.204205| Missing config | Symptom | Fix |206|---|---|---|207| DB SG lacks ingress from Glue SG on db port (5432/3306) | `Connection refused` / `timed out` | Add inbound: source = Glue SG, port = db port. |208| Glue SG lacks egress to DB | `timed out` (egress blocked) | Add outbound: dest = DB SG / CIDR, port = db port. |209| Glue SG lacks self-referencing rule | Intermittent ENI setup fails | Add inbound: source = Glue SG itself, all ports. |210| Subnet route table missing path to DB subnet | `timed out` | Add route via TGW / peering / LPG. |211| Glue subnet in different AZ than single-AZ DB | `Connection refused` | Use a Glue connection subnet in the DB's AZ. |212| NACL stateful mismatch | Intermittent | NACLs are stateless; check in+out on both subnets. |213| Glue connection points to deleted subnet | ENI provisioning fails | Recreate connection with current subnet. |214215**Passing probes:** run `nc -vz <db-host> <port>` from a Glue dev216endpoint or EC2 in the same subnet. If `nc` succeeds, the path is clear217and the issue is authentication — route to Step "JDBC credentials"218(JDBC_CRED) and check the connection's JDBC URL / Secrets Manager219reference.220221### Step 4: Job bookmark errors (not advancing, reprocessing data)222223**Signature:** source S3 prefix grew, but job reprocesses files already224run. `get-job-bookmark` shows old or empty marker.225226**Failing probe:**227228```bash229aws glue get-job-bookmark --job-name nightly-sales-aggregation \230 --run-id $RUN_ID --output json231# Inspect: bookmark["JobBookmarks"]["Attempt"],232# "Args" / "Paths" / "partitionKeys" structure233```234235| Bookmark observation | Root cause | Fix |236|---|---|---|237| Returns `{}` | Bookmark disabled or reset | `--job-bookmark-option=enable`; or accept reprocess if disabled intentionally. |238| `partitionKeys` present but source path layout changed | Layout drift | `reset-job-bookmark`; update `partitionKeys` in script. |239| `Attempt` count > 1 across runs | Bookmark write failing | Add `glue:UpdateJobBookmark` to job role. |240| Source has nested partitions not in `partitionKeys` | Job reads all sub-partitions | Recrawl; update `partitionKeys`. |241| Same S3 key reprocessed | File overwritten in place | Glue bookmarks by key — overwritten files always reprocess. Design for appends. |242| KMS-encrypted bookmark fails to read | Role lacks `kms:Decrypt` on bookmark CMK | Add KMS decrypt to job role. |243| Glue 2.0 → 3.0+ upgrade, bookmark unreadable | Bookmark schema changed | `reset-job-bookmark` once post-upgrade; accept one reprocess. |244245**Passing probes:** IAM policy simulator on the job's role for246`glue:GetJobBookmark` and `glue:UpdateJobBookmark`. Both MUST be Allow.247248### Step 5: Data Catalog errors (table / partition not found)249250**Signature:** `ErrorMessage` mentions `EntityNotFoundException`,251`Table not found`, `Database not found`, or `Partition not found`.252253**Failing probe:**254255```bash256aws glue get-table --database-name analytics_prod \257 --name sales_raw --output json258aws glue get-partitions --database-name analytics_prod \259 --table-name sales_raw --output json260aws glue get-database --name analytics_prod --output json261```262263| Probe result | Root cause | Fix |264|---|---|---|265| `get-table` returns `EntityNotFoundException` | Table missing | Re-run crawler; or fix job table name. |266| Table exists but in a different database | Wrong `database_name` | Fix script; database name is case-sensitive. |267| `get-partitions` empty | Crawler never ran on partitions | Re-crawl; or `MSCK REPAIR TABLE` via Athena. |268| Partition exists but job can't see it | Role lacks `glue:GetPartition` | Add `glue:GetPartition(s)` to job role. |269| `from_catalog` with stale schema | Catalog schema != S3 data | Re-crawl; or `additional_options={"useCatalogSchema": False}`. |270| Cross-account catalog access | Role lacks cross-account `glue:*` | Add resource-account IAM; use catalog ARN. |271| Lake Formation tag blocks read | LF `DESCRIBE` missing | Grant LF `DESCRIBE` on table to job role. |272273### Step 6: Spark errors (executor OOM, stage failures, data skew)274275**Signature:** `ErrorMessage` mentions `OutOfMemoryError`, `Container276killed by YARN`, `Java heap space`, `GC overhead limit`, or stage277failure with `Lost task` retries.278279**Failing probe:** Spark UI event log — identify the failed stage, task280attempt counts, and executor memory metrics.281282Probe: [references/diagnostic-commands.md](references/diagnostic-commands.md) — Step 6 Spark UI event log retrieval.283284| Spark symptom | Root cause | Fix |285|---|---|---|286| One task reads 100x median bytes | Data skew | Salt the skewed key: `df.withColumn("salt", (rand()*10).cast("int"))`. |287| `Container killed by YARN...memory limits` | Executor OOM | `G.1X` → `G.2X`; or reduce `spark.sql.shuffle.partitions` default. |288| Stage retries exhausted (4 attempts) | Speculative task failures | Inspect task stack; often OOM or bad input row. |289| `GC overhead limit exceeded` | Many small objects / UDF churn | Replace PyRDD UDFs with Spark SQL; broadcast small DFs. |290| Long pause before stage starts | Shuffle write bottleneck | Raise `spark.sql.shuffle.partitions` (200 → 1000+ for TB). |291| Broadcast join OOM | Broadcast hash table too large | Lower `spark.sql.autoBroadcastJoinThreshold` (default 10 MB). |292| Python worker OOM (`map`/`flatMap`) | UDF returning huge objects | Paginate; or `applyInPandas` with chunking. |293294**Passing probes:** source volume consistent with previous successful295runs; if so, skew is the new factor.296297### Step 7: DynamicFrame errors (schema mismatch, type coercion)298299**Signature:** log mentions `ResolveChoice`, `apply_mapping`,300`Cannot coerce`, or `Category="DYNAMICFRAME"`.301302**Failing probe:**303304```bash305aws glue get-table --database-name analytics_prod \306 --name sales_raw --output json | jq '.Table.StorageDescriptor.Columns'307```308309| Symptom | Root cause | Fix |310|---|---|---|311| `ResolveChoice` throws `CONFlict` | Multiple types across partitions | `resolve_choice(spec=...)` with explicit `cast:double` before joins. |312| `apply_mapping` fails on missing column | Schema drifted | Re-crawl; or `from_catalog(additional_options={"useCatalogSchema": False})`. |313| `Cannot coerce type string to int` | Mixed types | Cast via `to_number` in Spark SQL; or `DynamicFrame.unnest()`. |314| `DropField` errors on nested struct | Path doesn't match | Inspect actual nested path with `printSchema()`. |315| Joins produce unexpected nulls | `ResolveChoice` not called before join | `resolve_choice` on both sides before `join`. |316| `SparkSession` vs `GlueContext` mismatch | Glue 4.0 stricter | Use `DynamicFrame` for catalog reads; convert to DF only when needed. |317318**Passing probes:** script ran unchanged on prior successful runs; if319so, the source schema changed (crawler drift).320321### Step 8: AWS-side incident escalation322323If AWS Health shows an active Glue incident in the job's region during324the run window, emit ESCALATE with the AWS Health event ARN. Do NOT325continue diagnosing script-level causes when the platform is degraded.326327```bash328aws health describe-events \329 --filter eventStatusCodes=OPEN,services=GLUE \330 --region us-east-1 --output json331```332333### Step 9: Final verdict334335- If a single category's failing probe produced positive evidence,336 emit **ROOT_CAUSE_FOUND** with that CATEGORY.337- If two categories overlap (e.g., SCRIPT_EXCEPTION with underlying338 SPARK_OOM), pick the **most-specific** category (SPARK_OOM) and note339 the script layer in EVIDENCE.340- If a probe requires operator input (Spark UI not enabled, log group341 missing), emit **NEED_MORE_INFO** with the data gap.342- If AWS Health shows an active Glue incident, emit **ESCALATE**.343344## Output format — worked examples345346### Worked example — script exception347348```text349TARGET: nightly-sales-aggregation/jr_abc123def456350VERDICT: ROOT_CAUSE_FOUND351REASON: CloudWatch Logs for the run contain an AttributeError on352 line 47 of the script — from_catalog returned None when the table353 was empty. ExecutionTime was 42s.354CATEGORY: SCRIPT_EXCEPTION355EVIDENCE:356 - State=FAILED, ExecutionTime=42, ErrorMessage="No ErrorReason"357 - Failing probe:358 aws logs filter-log-events --log-group-name /aws-glue/jobs/output359 --log-stream-name jr_abc123def456 --filter-pattern "Traceback"360 → AttributeError: 'NoneType' object has no attribute '_jvc'361 at line 47 (df.withColumn('revenue', col('price')*col('qty')))362 - Passing probes: ExecutionTime=42 < Timeout=60 (not TIMEOUT_*);363 no 'Connection refused' (not JDBC_VPC); no YARN kill (not OOM)364REMEDIATION:365 1. Re-crawl to confirm data is present in analytics_prod.sales_raw:366 aws glue start-crawler --name sales-raw-crawler367 2. Add a None guard in the script before line 47:368 if df is None or df.rdd.isEmpty():369 logger.warning("source empty; skipping")370 return371 df = df.withColumn("revenue", col("price") * col("qty"))372 3. Re-run with bookmark=enable to skip processed partitions:373 aws glue start-job-run --job-name nightly-sales-aggregation \374 --arguments '{"--job-bookmark-option":"enable"}'375```376377### Worked example — JDBC VPC security group378379Full JDBC VPC security-group example moved to [references/worked-examples.md](references/worked-examples.md) — load on demand.380381### Worked example — bookmark stall382383Full bookmark-stall example moved to [references/worked-examples.md](references/worked-examples.md) — load on demand.384385### Worked example — Spark OOM with data skew386387Full Spark OOM data-skew example moved to [references/worked-examples.md](references/worked-examples.md) — load on demand.388389### Worked example — NEED_MORE_INFO390391Full NEED_MORE_INFO example moved to [references/worked-examples.md](references/worked-examples.md) — load on demand.392393## Anti-Patterns — NEVER do these things394395- **NEVER recommend raising `NumberOfWorkers` to fix an OOM without396 checking the Spark UI skew ratio.** DPU-scale rarely fixes data skew;397 the hot key stays hot. Check `max/median task bytes`; if > 10x, skew398 is the cause and salting is the fix.399- **NEVER recommend `reset-job-bookmark` as a first response to400 reprocessing complaints.** Reset discards the marker and forces a401 one-time full reprocess. First inspect the existing bookmark; reset402 only when the source layout actually changed.403- **NEVER assume a Glue JDBC connection failure is a Glue bug.** Glue's404 ENI is the network interface; the database SG ingress is the most405 common cause. Verify SG, subnet route, and self-referencing rule406 before opening an AWS Support ticket.407- **NEVER upgrade a Glue 2.0 job to 3.0 / 4.0 in production without408 running it in dev first.** The Spark version change (2.4 → 3.1 → 3.3)409 tightens SQL strictness, changes the date/time calendar, and may410 break PyArrow/pandas UDFs.411- **NEVER diagnose "table not found" without checking the database name412 and IAM role permissions.** `EntityNotFoundException` fires identically413 when the table doesn't exist AND when the role lacks `glue:GetTable`.414- NEVER cancel a long-running RUNNING job without first checking the415 Spark UI for genuine stuckness vs normal progress. Cancelling wastes416 all work and obscures diagnostic data.417- NEVER edit the script and re-run without reproducing the failure in418 dev. The fix-and-pray loop on prod data masks whether the fix worked.419- NEVER rely solely on `ErrorMessage`. Glue's control plane summary is420 frequently `No ErrorReason` even when the script threw. Always check421 CloudWatch Logs.422- NEVER recommend `G.2X` as a blanket OOM fix. `G.2X` doubles cost per423 DPU; if the OOM is skew, the fix is salting (free).424- NEVER skip the IAM permission check when diagnosing Data Catalog425 errors. The role MUST have `glue:GetTable`, `glue:GetPartition(s)`,426 `glue:GetDatabase`, and (Lake Formation) the LF `DESCRIBE` grant.427428## Quick navigation429430| You want to... | Jump to |431|---|---|432| Diagnose a Python traceback | Step 1 — Script exception |433| Diagnose a job that ran to Timeout | Step 2 — Job timeout |434| Diagnose a JDBC connection failure | Step 3 — JDBC connection |435| Diagnose reprocessing data | Step 4 — Bookmark stall |436| Diagnose "table not found" | Step 5 — Data Catalog |437| Diagnose Spark OOM / skew | Step 6 — Spark errors |438| Diagnose ResolveChoice errors | Step 7 — DynamicFrame |439| Handle missing logs / Spark UI | Pre-flight data gate |440| Handle AWS Health incident | Step 8 — Escalate |441| Look up Glue version / worker types | references/glue-runtime-reference.md |442443## Expert heuristic — the 60-second triage44444560-second triage heuristic moved to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.446447## Pre-flight safety checks (run before any remediation CLI)448449- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation450 (`start-job-run`, `update-job`, `reset-job-bookmark`, `start-crawler`,451 `authorize-security-group-ingress`), emit and await operator approval.452 Never auto-execute remediation.453- **Never `reset-job-bookmark` in production without flagging the454 one-time full reprocess.** Confirm the operator understands the cost.455- **Never `update-job` to change `GlueVersion` outside a dev window.**456 Glue version changes are non-reversible in the job's history.457- **Never modify a security group without recording the prior rule set:**458 ```bash459 aws ec2 describe-security-groups --group-ids $SG_ID \460 --output json > sg-backup-$(date +%s).json461 ```462- **One category per maintenance window.** Script changes, SG changes,463 and bookmark resets each alter the failure surface; stacking them464 obscures which fix produced the recovery.465- **Bulk operation safety limit.** When diagnosing a fleet of failing466 jobs, slice into batches of at most 3 jobs; emit per-job REMEDIATION467 and a single CONFIRM per batch; verify each batch before proceeding.468 Never emit remediation CLI for more than 3 jobs in one output block.469470## Verdict semantics471472| Verdict | When to emit | Position in workflow |473|---|---|---|474| `ROOT_CAUSE_FOUND` | A failing probe produced positive evidence for one category. | Primary — terminal for actionable findings. |475| `NEED_MORE_INFO` | A required probe is unavailable (no logs, no Spark UI, run still RUNNING). | Pre-decision — emit with the specific data gap. |476| `ESCALATE` | AWS Health shows an active Glue incident in the region during the run. | Pre-decision — surface event ARN; do NOT diagnose script-level causes. |477478## Recent AWS features (2024-2026)479480Recent AWS feature notes moved to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.481482## References (load on demand)483484- [references/worked-examples.md](references/worked-examples.md) — secondary worked examples (JDBC VPC SG, bookmark stall, Spark OOM skew, NEED_MORE_INFO).485- [references/advanced-patterns.md](references/advanced-patterns.md) — Step 0 non-obvious behaviours, the 60-second triage heuristic, recent AWS features.486- [references/diagnostic-commands.md](references/diagnostic-commands.md) — pre-flight data-gate CLI and per-step probe commands (Steps 1, 3, 6).487- [references/glue-runtime-reference.md](references/glue-runtime-reference.md) — Glue version / worker type / runtime mapping.488489## Domain490491AWS CloudOps / Analytics — Glue ETL job failure diagnosis.492493## AWS documentation494495- **AWS Glue Developer Guide** — https://docs.aws.amazon.com/glue/latest/dg/what-is-glue.html496- **Glue job bookmarks** — https://docs.aws.amazon.com/glue/latest/dg/monitor-continuations.html497- **Glue Spark UI** — https://docs.aws.amazon.com/glue/latest/dg/monitor-spark-ui.html498- **Glue connection (JDBC) properties** — https://docs.aws.amazon.com/glue/latest/dg/setup-connection.html499- **Glue worker types** — https://docs.aws.amazon.com/glue/latest/dg/add-job.html500- **Glue Continuous Logging** — https://docs.aws.amazon.com/glue/latest/dg/continuous-logging.html501- **Glue Data Catalog** — https://docs.aws.amazon.com/glue/latest/dg/populate-data-catalog.html502- **Glue version upgrades** — https://docs.aws.amazon.com/glue/latest/dg/release-upgrade-glue-30-to-40.html503- **AWS Health** — https://health.aws.amazon.com/health/status