Managed Airflow Dag Troubleshooting
GoogleOfficialPublished by Google
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured, deterministic approach to troubleshooting Apache Airflow DAGs within Managed Service for Apache Airflow (MSAA). It guides users through log retrieval, metadata inspection, and source code analysis to identify root causes such as configuration mismatches, resource constraints, or platform-level errors. The skill emphasizes evidence-based diagnosis, requiring users to correlate specific log payloads with DAG source code before suggesting any remediation.
What it does
- Provides commands to fetch task states and metadata for specific DAG runs.
- Offers specific Cloud Logging queries to identify common platform failure modes.
- Guides the retrieval of remote DAG source code and pipeline YAML definitions from GCS.
- Maps failed Airflow tasks to logical actions in orchestration pipelines.
- Helps correlate BigQuery and other service errors with DAG configuration parameters.
- Ensures all diagnostic steps are grounded in verifiable log evidence.
When to use it
- When a DAG run or specific task instance fails unexpectedly in Managed Airflow.
- When you need to identify if a failure is caused by code logic, configuration, or platform issues.
- When investigating timeouts, zombie tasks, or resource-related failures in your environment.
- When you need to map a failed task back to a specific logical action in an orchestration pipeline.
Advantages
- Promotes a deterministic, evidence-based troubleshooting workflow.
- Reduces guesswork by providing specific log queries for known platform issues.
- Standardizes the process of correlating task logs with source code parameters.
- Includes clear instructions for handling complex, pipeline-generated DAGs.
Usage examples
- “My DAG 'daily_sales_report' failed. How do I find out why?”
- The agent will list the failed task instances for that DAG run, fetch the relevant error logs, and guide you through comparing the task's configuration against the DAG source code.
- “I see a 'Detected zombie job' error in my Airflow logs. What should I do?”
- The agent will explain that this indicates a missing heartbeat, likely due to worker resource starvation, and suggest checking worker metrics or scaling your environment.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/managed-airflow-dag-troubleshooting/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip managed-airflow-dag-troubleshooting.zip -d .agents/skills
Documentation by Google
Managed Service for Apache Airflow (formerly Cloud Composer) DAG troubleshooting guide
This skill provides instructions for troubleshooting Managed Airflow DAGs (DAG
runs and task instances), utilizing gcloud composer, gcloud logging and
gcloud storage commands to fetch remote logs and code.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:managed-airflow-dag-troubleshooting)"
and append agent-skills/1.0 (skill:managed-airflow-dag-troubleshooting) to User-Agent headers.
General rules
Provide suggestions on how to troubleshoot the failed jobs. Provide only the steps that the user can actually take. Ground all troubleshooting advice in direct findings.
When troubleshooting a failure, follow the following practices to always provide a deterministic diagnosis:
Fetch relevant logs: Always fetch the logs for a task under investigation using
gcloud logging read; check the logs for specific error patterns: Python tracebacks, API error codes (e.g., 400, 403, 404, 500), or Airflow signals (e.g.,AirflowTaskTimeout).Fetch task metadata: When troubleshooting a task, fetch the task state and metadata (execution state, try number, timestamps, and execution details) using:
gcloud composer environments run {env_name} \ --location {location} \ tasks states-for-dag-run -- -d {dag_id} -r {run_id}or for an individual task instance:
gcloud composer environments run {env_name} \ --location {location} \ tasks state -- {dag_id} {task_id} {execution_date}Retrieve and compare DAG source code: Download the remote DAG source code using
gcloud storage cp gs://{bucket_name}/dags/{dag_file}.py .(find the environment bucket viagcloud composer environments describe {env_name} --location {location} --format="value(config.dagGcsPrefix)"). Compare the parameters in the code (e.g., table IDs, disk sizes, URI paths) against the error messages found in the task logs.Explain code mistakes and potential fixes: Explain mistakes in the code (if any are actually visible); suggest potential fixes (if they are very likely to be meaningful); discuss source code availability if needed - if some source code is unavailable (e.g. imported from a file other than the main source code file), mention this (you can mention the package name) - in such a case take into account most likely trigger rules if they are unknown.
Check for environment-level errors: Query Cloud Logging with
gcloud logging readto see if there are high-level environment issues or known platform errors correlating with the failure (see Known issues below). You MUST return ALL found issues.Identify failing tasks in a DAG run: When troubleshooting a failed DAG run, mention the task that caused a failure (use
tasks states-for-dag-runor Cloud Logging to identify failed tasks). Provide a task instance name. If many tasks failed, mention which task was critical (mandatory for successful DAG run execution - look into task dependencies and trigger rules) and focus on this one.Verify service configurations in code: If logs suggest an issue with a specific service (e.g., BigQuery, Dataform, Compute Engine), use the log details to verify the configuration in the DAG source code.
Correlate logs with code: E.g., if BigQuery returns a 404, verify the dataset ID or table ID in the DAG source code matches reality.
Prioritize known platform issues: Check against Known issues below. If Cloud Logging queries return matching platform error signals, prioritize that diagnosis.
Summarize with Evidence (Deterministic Response): Your response must be specific. Avoid general advice like 'check your permissions.' or 'check the logs.' Instead, say 'The service account is missing X permission.'
Problem: State the specific root cause and the exact task instance ID. Identify if it is a code logic error, a configuration mismatch, or an environment timeout.
Evidence: Mandatory. Provide the verbatim text from the log (
textPayload) or the specific line of code from the DAG that caused the failure. Do not summarize the evidence; show the data.Recommendation: Provide an actionable fix. If it is a code error, provide the corrected Python snippet. If it is a resource issue, specify the exact configuration change needed.
DAGs Generated by Orchestration Pipelines: Some DAGs may be generated by Orchestration Pipelines. A special requirement related to those DAGs is the need to explain the failure in terms of the logical actions defined in the pipeline YAML.
Determine if a DAG is generated by Orchestration Pipelines: Orchestration Pipeline DAGs deployed by dedicated tools have
bundle_name,version_id, andpipeline_nameset in their DAG Run metadata (DagRun.notethat contains JSON metadata). All of them (i.e. Orchestration Pipeline DAGs deployed by dedicated tools and created manually) have anop:orchestration_pipelinetag set (DAG properties, including tags, can be verified in the DAG source code or viagcloud composer environments run {env_name} --location {location} dags list).Orchestration Pipeline DAGs deployed by dedicated tools have additionally the following tags (information in those tags should be consistent with data in DAG Run attributes mentioned above):
pipeline name - tag
op:pipeline, e.g.op:pipeline:xyzindicates a namexyzbundle name - tag
op:bundleversion id - tag
op:version
Retrieve the resolved pipeline YAML definition from the environment bucket:
Determine the YAML file location:
Retrieve the DAG source code from the environment bucket using
gcloud storage cp gs://{bucket_name}/dags/{dag_file}.py .(orgcloud storage cat gs://{bucket_name}/dags/{dag_file}.py).Inspect the source code for
generateorgenerate_dagsfunction calls:Scenario 1:
generatecall found. The first argument is the path to the YAML file - relative to thedagsfolder in environment's bucket.Scenario 2:
generate_dagscall found.Extract the first argument - this is the data folder. If it starts with
/home/airflow/gcs/, remove this prefix to get a path relative to the root of environment's bucket.Extract
bundle_name,version_id, andpipeline_name(as explained above).Construct the path:
{data_directory}/{bundle_name}/versions/{version_id}/{pipeline_name}.yml(or.yaml).
Scenario 3: If neither call is found, default to the path:
data/{bundle_name}/versions/{version_id}/{pipeline_name}.yml(or.yaml) in an environment's bucket.
Download the YAML file using
gcloud storage cp gs://{bucket_name}/{yaml_path} .(orgcloud storage cat gs://{bucket_name}/{yaml_path}).
Map the failed Airflow task back to the logical action name using task instance metadata/notes (e.g.
op_action_namein tasknote).If the failure involves user assets (like Python scripts), check their path in the action definition. If they are in the environment bucket, download and read them to debug (
gcloud storage cp gs://{bucket_name}/{asset_path} .). If they are in a custom artifact bucket (see GCS URIs in logs/config), note the limitation that they cannot be read directly but analyze based on available logs.
You can assume that environment variables set by default (they can be used in DAG code, but are not visible in custom environment configuration), e.g.
GCS_BUCKET, are correct - users cannot change them."Not found" (404) errors from GCP APIs can be misleading. A "not found" error might be returned when a resource actually exists, but the caller does not have permissions to access or view it. If a resource is expected to exist, suggest verifying proper permissions.
Important constraints & instructions
Read-Only First: Do NOT attempt to fix the code immediately. You must first prove the root cause using logs and remote code.
No Speculation: If logs are empty or code cannot be found, state this clearly. Always reference error messages as the are.
Safety: Be careful with secrets. If logs contain sensitive information (e.g. passwords), redact it in your analysis.
Applying Fixes - only if explicitly requested
When the RCA is complete and a fix is ready:
Repository Check: If the current workspace does not seem to be the source of truth for the Managed Airflow environment:
Ask the user to open the correct repository.
OR ask if they want to download the remote DAG to the current workspace to apply the fix (warning them about potential overwrites).
Relevant gcloud commands
Environment & DAG Discovery
List composer environments:
gcloud composer environments list \ --locations=us-central1 \ --format="table(name,location,state)"Describe environment (get DAGs bucket and config):
gcloud composer environments describe {env_name} \ --location {region} \ --format="value(config.dagGcsPrefix)"List composer DAGs:
gcloud composer environments run {env_name} \ --location {region} \ dags listList composer DAG Runs:
gcloud composer environments run {env_name} \ --location {region} \ dags list-runs -- -d {dag_id} --no-backfillList task instance states for a DAG run:
gcloud composer environments run {env_name} \ --location {region} \ tasks states-for-dag-run -- -d {dag_id} -r {run_id}Get state of a specific task instance:
gcloud composer environments run {env_name} \ --location {region} \ tasks state -- {dag_id} {task_id} {execution_date}
Log Retrieval
Fetch error logs for a DAG / Task:
gcloud logging read 'resource.type="cloud_composer_environment" AND resource.labels.environment_name="{env_name}" AND labels.dag_id="{dag_id}" AND severity>=ERROR' \ --limit=25 \ --format="table(timestamp,severity,labels.task_id,textPayload)"Fetch scheduler logs for environment failures:
gcloud logging read 'resource.type="cloud_composer_environment" AND resource.labels.environment_name="{env_name}" AND log_id("airflow-scheduler") AND severity>=ERROR' \ --limit=25 \ --format="table(timestamp,severity,textPayload)"
Code & Asset Retrieval
Download DAG code from GCS:
gcloud storage cp gs://{bucket_name}/dags/{dag_file}.py .Download pipeline YAML definition or script from GCS:
gcloud storage cp gs://{bucket_name}/{path_to_file} .
Known issues related to DAG runs and task instances
Use gcloud logging read with the queries below to identify specific known
platform failure modes:
1. DAG_RUN_TIMEOUT
Issue summary: The task instance execution was interrupted because a timeout for a DAG was exceeded. Unfinished tasks were marked as 'SKIPPED' or failed.
Cloud Logging Query:
gcloud logging read 'resource.type="cloud_composer_environment" AND resource.labels.environment_name="{env_name}" AND log_id("airflow-scheduler") AND textPayload=~"Run .* of .* has timed-out"' --limit=10
2. TASK_QUEUED_TIMEOUT
Issue summary: Task failed because it remained queued longer than the maximum allowed queue time.
Cloud Logging Query:
gcloud logging read 'resource.type="cloud_composer_environment" AND resource.labels.environment_name="{env_name}" AND log_id("airflow-scheduler") AND textPayload=~"Task requeue attempts exceeded max; marking failed"' --limit=10Remediation: Consider increasing worker resources (CPU, memory, worker count) or adjusting
[celery]worker_concurrency.
3. TASK_STUCK_IN_QUEUE
Issue summary: Task reached DAG run timeout because task was stuck in queue for too long.
Cloud Logging Query:
gcloud logging read 'resource.type="cloud_composer_environment" AND resource.labels.environment_name="{env_name}" AND log_id("airflow-scheduler") AND textPayload=~"Task stuck in queued; will try to requeue"' --limit=10Remediation: Consider increasing the timeout or reducing the load on the environment.
4. BIGQUERY_JOB_FAILED
Issue summary: Task failed because of a BigQuery job failure inside a BigQuery operator.
Cloud Logging Query:
gcloud logging read 'resource.type="cloud_composer_environment" AND resource.labels.environment_name="{env_name}" AND (log_id("airflow-worker") OR log_id("airflow-k8s-worker")) AND textPayload:"airflow/providers/google/cloud/operators/bigquery.py" AND textPayload:"Task failed with exception" AND severity=ERROR' --limit=10Remediation: Inspect the worker logs for the BigQuery Job ID (
Job ID: ...) to diagnose the underlying query error or permissions issue.
5. DETECTED_ZOMBIE
Issue summary: The task instance was revoked by the executor due to missing heartbeats. Task instances send heartbeats periodically (every
job_heartbeat_sec, 5 seconds by default) and if heartbeats are missing forscheduler_zombie_task_threshold(300 seconds by default), the task is considered a zombie and marked as failed or up for retry.Cloud Logging Query:
gcloud logging read 'resource.type="cloud_composer_environment" AND resource.labels.environment_name="{env_name}" AND log_id("airflow-scheduler") AND (textPayload:"Detected zombie job:" OR textPayload:"Detected a task instance without a heartbeat:")' --limit=10Remediation: This can happen when a worker is overloaded (CPU/memory starvation) and unable to send heartbeats on time, a worker was terminated with unfinished tasks (OOM kill/eviction), or the metadata database is overloaded. Check worker metrics and consider scaling worker CPU/memory.
6. WORKER_OUT_OF_POD_STORAGE
Issue summary: Task instance failed because a worker is running out of pod storage (ephemeral disk space reached or pod evicted due to storage limits).
Cloud Logging Query:
gcloud logging read 'resource.type="cloud_composer_environment" AND resource.labels.environment_name="{env_name}" AND (log_id("airflow-worker") OR log_id("airflow-k8s-worker")) AND textPayload:"Pod ephemeral local storage usage exceeds the total limit of containers"' --limit=10Remediation: Update the worker storage configuration according to the amount of data being stored or clean up temporary files created during task execution.
Files
- ATTRIBUTION.mdAdded by AutoGineer888 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md16.4 KiB
- references/attribution.md1.9 KiB
LICENSE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs a command-line tool
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Publisher
- Google (Official)
- Source
- google/skills · skills/cloud/managed-airflow-dag-troubleshooting · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download managed-airflow-dag-troubleshooting.zip