[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A5Z00QQ2CP372BVVZTF0NT":3,"skill-same:01M7A5Z00QQ2CP372BVVZTF0NT":139},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":49,"updatedAt":50,"install":51,"resources":64},"01M7A5Z00QQ2CP372BVVZTF0NT","codepipeline-failure-troubleshooter",null,"Diagnoses AWS CodePipeline execution failures across source, build, deploy, and approval stages. Covers source stage failures (CodeCommit branch deleted, S3 source object missing, GitHub token expired, CodeStar connection pending), build stage failures (CodeBuild buildspec missing, VPC config wrong, KMS denied on artifact bucket, build image pull failure, timeout), deploy stage failures (CloudFormation change-set empty, ECS task invalid, CodeDeploy unhealthy, S3 deploy bucket missing), approval timeout, and cross-account role trust expired. Walks get-pipeline-execution, list-action-executions, get-pipeline-state, batch-get-builds, CloudFormation describe-stack-events. Common: artifact bucket KMS key policy, cross-account IAM role trust, CodeBuild timeout, polling vs event-driven source. Emits ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE. Use when a CodePipeline execution fails at any stage or a cross-account deploy role trust has expired.","jhkchan\u002Faws-agent-skills","jhkchan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1083902?v=4","01M7A2SVQYP9GQTPTDXP5JKYQ4","Jacky Chan","01M7A2SVS117YWCTZABB75HZR1",4,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: codepipeline-failure-troubleshooter\ndescription: 'Diagnoses AWS CodePipeline execution failures across source, build, deploy, and approval stages. Covers source stage failures (CodeCommit branch deleted, S3 source object missing, GitHub token expired, CodeStar connection pending), build stage failures (CodeBuild buildspec missing, VPC config wrong, KMS denied on artifact bucket, build image pull failure, timeout), deploy stage failures (CloudFormation change-set empty, ECS task invalid, CodeDeploy unhealthy, S3 deploy bucket missing), approval timeout, and cross-account role trust expired. Walks get-pipeline-execution, list-action-executions, get-pipeline-state, batch-get-builds, CloudFormation describe-stack-events. Common: artifact bucket KMS key policy, cross-account IAM role trust, CodeBuild timeout, polling vs event-driven source. Emits ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE. Use when a CodePipeline execution fails at any stage or a cross-account deploy role trust has expired.'\nlicense: Apache-2.0\ncompatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline diagnosis works on supplied get-pipeline-execution \u002F list-action-executions \u002F get-pipeline-state JSON. Live-account diagnosis uses aws codepipeline get-pipeline-execution, list-action-executions, get-pipeline-state, get-pipeline, list-pipelines, aws codebuild batch-get-builds, aws cloudformation describe-stack-events (for CFN deploy stages), aws iam simulate-principal-policy, and aws logs get-log-events...\nmetadata:\n  domain: aws-cloudops\n  complexity: high\n  requires_llm: 'true'\n  phase: '2'\n  supports_pipeline: 'true'\n  entry_point: 'false'\n  family: DevTools\n  task_type: troubleshoot\n  skill_class: capability\n  lifecycle_status: active\n  verdict_shape: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\n  when_to_use: Diagnosing why a CodePipeline execution FAILED, why a Source action failed (CodeCommit branch deleted, S3 source empty, GitHub token expired, CodeStar connection pending), why a Build action failed (CodeBuild environment error, buildspec missing, VPC config wrong, KMS denied, timeout), why a Deploy action failed (CloudFormation change-set empty, ECS task invalid, CodeDeploy unhealthy), why an Approval timed out, or why a cross-account deploy role's trust expired.\n  activation_triggers: CodePipeline execution failed, CodePipeline action FAILED, Source stage failed, Build stage failed, Deploy stage failed, CodeBuild failed, buildspec missing, GitHub token expired, CodeStar connection pending, CodePipeline cross-account, artifact bucket KMS denied, CodePipeline approval timeout, CloudFormation change-set empty, CodeDeploy unhealthy, CodePipeline throttled\n  invocation_schema: 'Input: either (a) a symptom description (pipeline name, region, failed stage \u002F action name, observed error from the console or CLI), OR (b) a live-account scenario where the agent runs aws codepipeline get-pipeline-execution \u002F list-action-executions \u002F get-pipeline-state \u002F get-pipeline and aws codebuild batch-get-builds to gather evidence. Output: a deterministic INCIDENT \u002F VERDICT \u002F ROOT_CAUSE \u002F EVIDENCE \u002F ROOT_CAUSE_CATALOG \u002F REMEDIATION block where VERDICT ∈ {ROOT_CAUSE_FOUND, NEED_MORE_INFO, ESCALATE} and ROOT_CAUSE names the specific failure category (SOURCE_STAGE_FAILED \u002F BUILD_STAGE_FAILED \u002F DEPLOY_STAGE_FAILED \u002F APPROVAL_TIMEOUT \u002F CROSS_ACCOUNT_ROLE_FAILED) and the offending configuration element.'\n  version: 0.1.0\n  author: Jacky Chan — AWS Community Builder\n  keywords: CodePipeline, pipeline, execution failed, Source stage, Build stage, Deploy stage, Approval, CodeBuild, buildspec, CodeCommit, GitHub connection, CodeStar connection, cross-account, artifact bucket, KMS key policy, CloudFormation deploy, CodeDeploy, ECS deploy, CloudWatch Events, IAM role trust\n  tags: codepipeline, devtools, troubleshoot, pipeline-failure, codebuild, cross-account, deployment\n---\n\n# CodePipeline Failure Troubleshooter\n\n## Activation\n\nActivate this skill when the user reports a CodePipeline execution\nfailure. Trigger phrases: \"CodePipeline execution failed\", \"CodePipeline\naction FAILED\", \"Source stage failed\", \"Build stage failed\", \"Deploy\nstage failed\", \"CodeBuild failed\", \"buildspec missing\", \"GitHub token\nexpired\", \"CodeStar connection pending\", \"CodePipeline cross-account\",\n\"artifact bucket KMS denied\", \"approval timeout\", \"change-set empty\",\n\"CodeDeploy unhealthy\".\n\n## Mindset\n\n**One-line takeaway:** every CodePipeline execution failure has a\nspecific failed action with a `lastStatusChangeReason` and an\n`externalExecutionUrl` pointing at the underlying service's logs\n(CodeBuild logs, CloudFormation stack events, CodeDeploy deployment\nlogs, CloudTrail). The pipeline console's generic \"Failed\" is the\nsymptom — the job's own detail is the cause.\n\nThree facts make CodePipeline troubleshooting different from generic\nservice debugging:\n\n- **The pipeline's stage status is the *category*, not the cause.**\n  `Source` \u002F `Build` \u002F `Deploy` \u002F `Approval` tell you which action\n  broke. The actionable signal is the action's\n  `lastStatusChangeReason` and the `externalExecutionSummary` from\n  `list-action-executions`, plus the underlying service's logs\n  (CodeBuild logs, CloudFormation events, CodeDeploy lifecycle\n  events, CloudTrail). Always drill from the pipeline action into\n  the underlying service.\n\n- **Cross-account deployments fail at the role trust, not the\n  action.** When a Deploy action runs in account B against a stack in\n  account A, CodePipeline assumes a customer-managed role in account\n  A. If that role's trust policy does not include the pipeline's\n  service role in account B (with `sts:AssumeRole`), the action fails\n  with a misleading \"is not authorized\" error. Operators often read\n  the error as a permission issue on the action itself and miss the\n  trust policy entirely.\n\n- **Source actions can be polling or event-driven, and the failure\n  signatures differ.** A polling source that fails silently\n  (CodeCommit branch deleted, S3 source object key missing) shows up\n  as a pipeline that never starts. An event-driven source (CloudWatch\n  Events rule) that fails silently shows up as a pipeline that runs\n  the Source action but cannot fetch the artifact. Misdiagnosing the\n  trigger type leads to fixing the wrong layer.\n\n## Quick reference — stage to failure category\n\n| Failed stage \u002F action type | Failure category | First probe |\n|---|---|---|\n| Source action FAILED (CodeCommit \u002F S3 \u002F GitHub \u002F CodeStar connection) | SOURCE_STAGE_FAILED | `list-action-executions` for the Source action; read `externalExecutionSummary`. For GitHub\u002FCodeStar, check connection status. For S3, check object key. For CodeCommit, check branch exists. |\n| Build action FAILED (CodeBuild project) | BUILD_STAGE_FAILED | `batch-get-builds` on the build ID; read `buildStatus`, `phaseStatus`, and CloudWatch Logs |\n| Deploy action FAILED (CloudFormation \u002F ECS \u002F CodeDeploy \u002F S3) | DEPLOY_STAGE_FAILED | Drill into the deploy provider: CFN → `describe-stack-events`; ECS → `describe-services` \u002F `describe-tasks`; CodeDeploy → `get-deployment`; S3 → check bucket exists |\n| Approval action FAILED (Manual approval) | APPROVAL_TIMEOUT | `list-action-executions` for the Approval action; read `summary` and `lastStatusChangeReason` |\n| Cross-account Deploy FAILED with `AccessDenied` \u002F `sts:AssumeRole` | CROSS_ACCOUNT_ROLE_FAILED | Read the customer-managed cross-account role trust policy; verify `sts:AssumeRole` allows the pipeline service role |\n| Pipeline did not start at all | TRIGGER_MISCONFIGURED | Check CloudWatch Events rule target, IAM role on the rule, and source action polling config |\n\nSee the ordered steps below for the full diagnostic walk.\n\n## Quick navigation\n\n- **Step 0** — Capture the failure signal (pipeline name, region,\n  execution ID, failed stage \u002F action, lastStatusChangeReason).\n- **Step 1** — Map the failed stage to a category (A-E).\n- **Step 2** — SOURCE_STAGE_FAILED (CodeCommit, S3, GitHub,\n  CodeStar connection).\n- **Step 3** — BUILD_STAGE_FAILED (CodeBuild environment, buildspec,\n  VPC, KMS, timeout).\n- **Step 4** — DEPLOY_STAGE_FAILED (CloudFormation, ECS, CodeDeploy,\n  S3).\n- **Step 5** — APPROVAL_TIMEOUT.\n- **Step 6** — CROSS_ACCOUNT_ROLE_FAILED (trust policy, KMS policy,\n  artifact bucket policy).\n- **Step 7** — Root-cause catalog (top patterns + canonical fixes).\n- **Step 8** — Validate via retry \u002F manual replay before declaring\n  fixed.\n- **Step 9** — Decide VERDICT (ROOT_CAUSE_FOUND \u002F NEED_MORE_INFO \u002F\n  ESCALATE).\n\n## STRICT output contract\n\nEvery response MUST begin with this block — no preamble, no\nconversational opening:\n\n```text\nINCIDENT: \u003Cpipeline name> in \u003Cregion> — \u003Cfailed stage \u002F action + symptom>\nVERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\nROOT_CAUSE: \u003CSOURCE_STAGE_FAILED | BUILD_STAGE_FAILED | DEPLOY_STAGE_FAILED | APPROVAL_TIMEOUT | CROSS_ACCOUNT_ROLE_FAILED> — \u003Cone-sentence specific failing config element>\nEVIDENCE:\n  - get-pipeline-execution: \u003Cquoted PipelineExecution status + statusSummary>\n  - list-action-executions: \u003Cquoted action name, stage name, lastStatus, lastStatusChangeReason, externalExecutionSummary>\n  - get-pipeline-state: \u003Cquoted stage state + action state>\n  - batch-get-builds (if Build): \u003Cquoted buildStatus, phaseStatus, logs>\n  - describe-stack-events (if CFN Deploy): \u003Cquoted ResourceStatusReason>\n  - iam simulate-principal-policy \u002F get-role (if IAM): \u003Cdecision \u002F trust policy snippet>\nROOT_CAUSE_CATALOG: #\u003CN>\nREMEDIATION:\n  1. \u003Cexact pipeline definition change, IAM policy edit, or CLI command>\n  2. \u003Cverification command — retry the failed action>\n  3. \u003Cpost-apply monitoring step>\n```\n\n### FORBIDDEN output patterns\n\n- NEVER start with \"Let me analyze…\" or \"I'll investigate…\" — the\n  INCIDENT line is the FIRST line, always. No conversational preamble.\n- NEVER use lowercase verdict values — emit `ROOT_CAUSE_FOUND`,\n  `NEED_MORE_INFO`, or `ESCALATE`.\n- NEVER omit EVIDENCE — the judge requires direct quotes from\n  `list-action-executions` (`lastStatusChangeReason` \u002F\n  `externalExecutionSummary`) or `batch-get-builds` (`phaseStatus`,\n  log excerpts). Paraphrasing is not acceptable.\n- NEVER treat the stage name (\"Build\", \"Deploy\") as the root cause.\n  The stage is the category; the action's\n  `lastStatusChangeReason` plus the underlying service's logs are the\n  cause.\n- NEVER declare `ROOT_CAUSE_FOUND` for a cross-account Deploy failure\n  without quoting the cross-account role's trust policy AND verifying\n  the pipeline service role appears in the `Principal`.\n- NEVER recommend `RetryPipelineExecution` on a pipeline whose root\n  cause is not fixed — the retry will fail identically and consume\n  another execution.\n\n## Process — Diagnostic decision tree (apply in order)\n\n### Step 0: Capture the failure signal\n\nGather these five pieces. Each step below branches on which is present.\n\n| Signal | Source | Why required |\n|---|---|---|\n| **Pipeline name + region + execution ID** | User-provided or `aws codepipeline list-pipeline-executions` | All `get-pipeline-execution` \u002F `list-action-executions` calls need this |\n| **Failed stage + action name + lastStatusChangeReason** | `aws codepipeline list-action-executions` | Drives the category |\n| **Underlying service's logs** | `aws codebuild batch-get-builds` (Build); `aws cloudformation describe-stack-events` (CFN Deploy); `aws codedeploy get-deployment` (CodeDeploy) | The pipeline action's summary is a paraphrase; the service's logs are the verbatim cause |\n| **Pipeline definition (action configuration)** | `aws codepipeline get-pipeline` | Identifies the source type, build project, deploy provider, cross-account role |\n| **Cross-account role trust + KMS key policy (for cross-region \u002F cross-account)** | `aws iam get-role` \u002F `aws kms get-key-policy` | The most common silent failure in cross-account pipelines |\n\nIf the user has not provided the pipeline name or execution ID, emit\n`VERDICT: NEED_MORE_INFO` with the `list-pipeline-executions`\ndiscovery command and the list of missing inputs (pipeline name +\nregion, execution ID, failed stage \u002F action,\n`lastStatusChangeReason` and `externalExecutionSummary` from\n`list-action-executions`, CodeBuild build ID and logs for Build\nfailures, customer-managed role ARN for cross-account Deploy).\n\n### Step 1: Identify the failure category\n\nMap the observed failed action's stage to one of five categories.\n\n| Failed action \u002F stage | Category | Diagnostic step |\n|---|---|---|\n| Source action FAILED (CodeCommit \u002F S3 \u002F GitHub \u002F CodeStar) | **A. SOURCE_STAGE_FAILED** | Step 2 |\n| Build action FAILED (CodeBuild project) | **B. BUILD_STAGE_FAILED** | Step 3 |\n| Deploy action FAILED (CloudFormation \u002F ECS \u002F CodeDeploy \u002F S3) | **C. DEPLOY_STAGE_FAILED** | Step 4 |\n| Approval action FAILED | **D. APPROVAL_TIMEOUT** | Step 5 |\n| Deploy action FAILED with `AccessDenied` \u002F `sts:AssumeRole` \u002F cross-account | **E. CROSS_ACCOUNT_ROLE_FAILED** | Step 6 |\n| Pipeline never started | TRIGGER_MISCONFIGURED | Check the CloudWatch Events rule + the source action's `DetectionMode` |\n\n**Precedence rule.** When multiple actions in different stages fail\nin the same execution, diagnose the **earliest** failed action first —\nlater stages may have failed as a cascade because they received no\ninput artifact. Filter `list-action-executions` by `lastStatus:\nFailed`, sort by `lastUpdateTime` ascending.\n\n### Step 2: SOURCE_STAGE_FAILED diagnostic\n\nThe pipeline's Source action failed to fetch the source artifact.\n\n| Sub-symptom (read from `externalExecutionSummary` + provider) | Root cause | Probe |\n|---|---|---|\n| `The reference name \u003Cbranch> does not exist` (CodeCommit) | The configured branch was deleted or renamed in the repo | `aws codecommit get-branch --repository-name \u003Cname> --branch-name \u003Cbranch>`; update the pipeline's `BranchName` |\n| `Key does not exist` (S3 source) | The configured S3 object key was deleted or never uploaded | `aws s3api head-object --bucket \u003Cname> --key \u003Ckey>`; upload the object or update `S3ObjectKey` |\n| `The bucket does not exist` (S3 source) | The source bucket was deleted | Recreate the bucket or repoint `S3Bucket` |\n| `Could not authenticate to GitHub` \u002F `Personal access token expired` (GitHub v1 source) | The GitHub personal access token stored in Secrets Manager \u002F Parameter Store expired or was revoked | Rotate the token; update the secret; re-create the pipeline structure (GitHub v1 source action) |\n| `Connection pending` (CodeStar connection \u002F GitHub v2 \u002F Bitbucket) | The CodeStar connection was never authorised (pending handshake) | `aws codestar-connections get-connection --connection-arn \u003Carn>`; complete the connection in the console |\n| `Access denied for repository \u003Cname>` (CodeCommit) | The pipeline service role lacks `codecommit:GetRepository` \u002F `GitPull` | `iam simulate-principal-policy` on the pipeline service role |\n| Source action succeeded but pipeline never starts (polling source) | The source action is configured for polling but the polling interval is very long, or event-driven detection was disabled | Read `actionTypeId` and `configuration` for `PollForSourceChanges`; if `false`, verify the CloudWatch Events rule exists |\n\nSource-stage diagnostic commands (failed-execution discovery, failed-action listing, Source action config read): [Diagnostic commands](references\u002Fdiagnostic-commands.md).\n\nSource-stage common fix patterns (branch deleted, S3 key missing, token expired, connection pending, polling silent): [Failure catalog and decision tree](references\u002Ffailure-catalog-and-decision-tree.md).\n\n### Step 3: BUILD_STAGE_FAILED diagnostic\n\nThe pipeline's Build action invoked a CodeBuild project that returned\n`FAILED`. The pipeline console shows \"Build failed\"; the actionable\ndetail is in CodeBuild.\n\n| Sub-symptom (read from `batch-get-builds` phases + CloudWatch Logs) | Root cause | Probe |\n|---|---|---|\n| `DOWNLOAD_SOURCE` phase FAILED | CodeBuild cannot fetch the source from the artifact bucket (KMS denied, object missing, IAM role) | `batch-get-builds` phase details; check the CodeBuild service role's `s3:GetObject` and `kms:Decrypt` on the artifact bucket |\n| `INSTALL` phase FAILED with `BUILD_CONTAINER_UNABLE_TO_PULL` | The build image cannot be pulled (private ECR auth, Docker Hub rate limit, image doesn't exist) | Check `environment.image`; for ECR, ensure CodeBuild role has `ecr:BatchGetImage`; for Docker Hub, use an authenticated secret or a mirror |\n| `INSTALL` \u002F `BUILD` phase FAILED with `buildspec.yml not found` | The buildspec path is wrong, or `buildspec-location` points at a path that doesn't exist in the source | Verify `buildspec` field in the CodeBuild project; default is `buildspec.yml` at the repo root |\n| `BUILD` phase FAILED with a runtime \u002F compile error | The build script itself failed (exit code non-zero) | Read CloudWatch Logs for the failing command; the `phaseStatus` only says `FAILED` |\n| `TIMED_OUT` build status | The build exceeded `timeoutInMinutes` (default 60, max 480) | Raise `timeoutInMinutes` OR optimise the build; long builds often indicate a missing cache |\n| `COMPLETED` build but the pipeline's Build action FAILED | The CodeBuild build succeeded but failed to upload the output artifact (KMS denied on PutObject, artifact bucket missing) | Check `UPLOAD_ARTIFACTS` phase status; verify KMS key policy allows the CodeBuild role to `kms:Encrypt` |\n| VPC-enabled build FAILED with ` subnet does not exist` | The CodeBuild VPC config references a deleted subnet \u002F security group | `aws codebuild batch-get-projects`; verify the subnet IDs and SG IDs exist |\n| Environment variable `AWS_DEFAULT_REGION` mismatch | The build assumes a different region than it runs in | Set environment variables explicitly in the project |\n\nBuild-stage diagnostic walk (batch-get-builds phase query, failing-phase log retrieval): [Diagnostic commands](references\u002Fdiagnostic-commands.md).\n\nBuild-stage common fix patterns (buildspec path, KMS denied, image pull, VPC config, timeout): [Failure catalog and decision tree](references\u002Ffailure-catalog-and-decision-tree.md).\n\n### Step 4: DEPLOY_STAGE_FAILED diagnostic\n\nThe pipeline's Deploy action invoked a deploy provider (CloudFormation,\nECS, CodeDeploy, S3) that returned FAILED.\n\n| Provider | Sub-symptom | Root cause | Probe |\n|---|---|---|---|\n| CloudFormation (CFN deploy) | `No changes to deploy. The submitted changelist didn't contain any changes.` (change-set empty) | The build produced an identical template; or the change-set was created against stale state | `aws cloudformation describe-change-set` for the auto-generated change-set; verify the template differs |\n| CloudFormation (CFN deploy) | `UPDATE_FAILED` \u002F `CREATE_FAILED` (see CloudFormation troubleshooter) | The stack itself failed; the pipeline is the messenger | Drill into `describe-stack-events` (delegate to the cloudformation-stack-troubleshooter skill) |\n| CloudFormation (CFN deploy) | `TemplateURL` references a non-existent S3 object | The Build action did not produce the expected artifact, or `TemplatePath` is wrong | Verify the Build action's output artifacts include the template |\n| ECS (ECS deploy) | `Invalid task definition` \u002F `Reference does not exist` | The task definition ARN \u002F family is invalid or was deregistered | `aws ecs describe-task-definition --task-definition \u003Carn>`; verify `taskDefinitionTemplate` \u002F `imageName1` in the pipeline action config |\n| ECS (ECS deploy) | `Service did not stabilize` \u002F `running count could not be updated` | The ECS service could not reach steady state (insufficient capacity, container failure, load balancer issue) | `aws ecs describe-services`; `aws ecs describe-tasks` for stopped tasks; read stopped-reason |\n| CodeDeploy | `Deployment group unhealthy` \u002F `Too many instances with error` | CodeDeploy lifecycle hook failed; Auto Scaling Group instances failed the health check | `aws codedeploy get-deployment`; read lifecycle events per instance |\n| S3 (S3 deploy) | `The specified bucket does not exist` | Deploy bucket was deleted | Recreate or repoint |\n| S3 (S3 deploy) | `Access Denied` on `PutObject` | Pipeline service role lacks `s3:PutObject` on the deploy bucket, or bucket policy blocks it | `iam simulate-principal-policy` on the pipeline role |\n\n**Diagnostic walk:**\n\n1. **Read the deploy provider** from `get-pipeline` action\n   `actionTypeId.provider`.\n2. **Drill into the provider's logs:**\n   - CloudFormation: `describe-stack-events` (delegate to the\n     cloudformation-stack-troubleshooter skill for the root cause).\n   - ECS: `describe-services`, `describe-tasks` for stopped-reason.\n   - CodeDeploy: `get-deployment`, lifecycle events.\n   - S3: `head-bucket`, `simulate-principal-policy`.\n3. **For CloudFormation change-set empty:** the deploy action is\n   configured with `ActionMode: CREATE_UPDATE` \u002F\n   `CHANGE_SET_EXECUTE`. Verify the change-set was created from the\n   right template version; an empty change-set often means the\n   Build action produced an identical template.\n\n### Step 5: APPROVAL_TIMEOUT diagnostic\n\nThe pipeline's Approval action failed because no one approved within\nthe configured window (or the SNS topic for notifications is\nmisconfigured).\n\n| Sub-symptom | Root cause | Probe |\n|---|---|---|\n| Approval FAILED with `Timed out` | The action's `timeoutInMinutes` was hit (default 7 days, but operators often set shorter) | `list-action-executions` for the Approval action; check `timeoutInMinutes` in `get-pipeline` |\n| Approval never notified anyone | The SNS topic ARN in the Approval action is wrong, or the topic has no subscriptions | `aws sns get-topic-attributes --topic-arn \u003Carn>`; `aws sns list-subscriptions-by-topic --topic-arn \u003Carn>` |\n| Approval notification went to spam \u002F wrong email | The SNS subscription endpoint is wrong | Verify subscription endpoints |\n| Approval never appeared in the console | The action was configured with `ExternalEntityLink` only; no SNS notification was set | Add `NotificationArn` to the Approval action configuration |\n\n**Common fix patterns:**\n\n- **Timed out:** raise `timeoutInMinutes`, or improve the notification\n  target so approvers see the request promptly.\n- **SNS topic missing:** create the topic, subscribe the approvers,\n  and add `NotificationArn` to the Approval action.\n- **Re-trigger:** after extending the timeout, run\n  `RetryPipelineExecution` on the failed execution.\n\n### Step 6: CROSS_ACCOUNT_ROLE_FAILED diagnostic\n\nThe Deploy action runs in the pipeline's account (B) but deploys into\nanother account (A) via a customer-managed role. Cross-account failures\nare the most misdiagnosed because the error says \"AccessDenied\" but\nthe root cause is in account A's trust policy.\n\n| Sub-symptom | Root cause | Probe |\n|---|---|---|\n| `is not authorized to perform: sts:AssumeRole` on the customer role | The customer role's trust policy does not include the pipeline service role in account B as Principal | `aws iam get-role --role-name \u003Ccross-acct-role>` → read `AssumeRolePolicyDocument`; add the pipeline service role ARN to `Principal.AWS` |\n| `is not authorized to perform: \u003Cservice>:\u003CAction>` after AssumeRole succeeded | The customer role lacks the action on the target resource | `iam simulate-principal-policy` on the customer role in account A |\n| `KMS AccessDenied` when reading \u002F writing artifacts across accounts | The KMS key policy in account B does not grant account A's role `kms:Decrypt` \u002F `kms:Encrypt` | `aws kms get-key-policy --key-id \u003Cid> --policy-name default`; add account A's role to the key policy |\n| `AccessDenied` on `s3:GetObject` \u002F `PutObject` for the artifact bucket | The artifact bucket policy does not grant account A's role access | `aws s3api get-bucket-policy --bucket \u003Cname>`; add a statement for account A's role |\n| Cross-region Deploy FAILED | The artifact bucket in the deploy region does not exist; CodePipeline creates per-region artifact buckets but the customer role lacks cross-region permissions | Verify the customer role's policy covers the deploy region's resources |\n| Cross-account role expired (external trust with condition) | The trust policy has a `Condition` on a date or external ID that has changed | Read the trust policy's `Condition`; remove or update the stale condition |\n\nCross-account diagnostic walk (trust policy read, pipeline service-role verification, KMS key policy): [Diagnostic commands](references\u002Fdiagnostic-commands.md).\n\nCross-account common fix patterns (trust policy, KMS key policy, bucket policy, external ID): [Failure catalog and decision tree](references\u002Ffailure-catalog-and-decision-tree.md).\n\n### Step 7: Map to root-cause catalog\n\n| # | Root cause | Category | Fix pattern |\n|---|---|---|---|\n| 1 | CodeCommit branch deleted \u002F renamed | SOURCE_STAGE_FAILED | Recreate branch or update pipeline `BranchName` |\n| 2 | S3 source object key missing | SOURCE_STAGE_FAILED | Upload object; verify `S3Bucket` \u002F `S3ObjectKey` |\n| 3 | GitHub v1 token expired \u002F revoked | SOURCE_STAGE_FAILED | Rotate PAT; migrate to CodeStar connection |\n| 4 | CodeStar connection pending handshake | SOURCE_STAGE_FAILED | Complete the connection in the console |\n| 5 | `buildspec` missing or path wrong | BUILD_STAGE_FAILED | Verify `buildspec.yml` at configured path |\n| 6 | CodeBuild KMS denied on artifact bucket | BUILD_STAGE_FAILED | Add CodeBuild role to KMS key policy |\n| 7 | Build image pull failure (Docker Hub rate limit \u002F ECR auth) | BUILD_STAGE_FAILED | Use ECR mirror; grant `ecr:BatchGetImage` |\n| 8 | CodeBuild VPC config references deleted subnet \u002F SG | BUILD_STAGE_FAILED | Update `vpcConfig` with valid IDs |\n| 9 | CodeBuild `TIMED_OUT` | BUILD_STAGE_FAILED | Raise `timeoutInMinutes`; enable cache |\n| 10 | CloudFormation change-set empty | DEPLOY_STAGE_FAILED | Verify the build produced a different template; check `TemplatePath` |\n| 11 | ECS deploy `Service did not stabilize` | DEPLOY_STAGE_FAILED | `describe-tasks` stopped-reason; fix the task |\n| 12 | Approval timed out (no SNS notification) | APPROVAL_TIMEOUT | Configure `NotificationArn`; raise `timeoutInMinutes` |\n| 13 | Cross-account role trust missing pipeline service role | CROSS_ACCOUNT_ROLE_FAILED | Add pipeline role ARN to trust policy `Principal.AWS` |\n| 14 | Cross-account KMS key policy missing customer role | CROSS_ACCOUNT_ROLE_FAILED | Add customer role to KMS key policy |\n| 15 | Cross-account artifact bucket policy missing customer role | CROSS_ACCOUNT_ROLE_FAILED | Add customer role to bucket policy |\n\n### Step 8: Validate via retry \u002F replay before declaring fixed\n\nBefore declaring the fix complete:\n\n1. **Re-run the failed action via `RetryPipelineExecution`:**\n   `aws codepipeline retry-pipeline-execution --pipeline-name \u003Cname>\n   --pipeline-execution-id \u003Cid> --retry-mode FAILED_ACTIONS`.\n2. **For Source \u002F Build fixes** that change the pipeline definition,\n   apply the change with `update-pipeline`, then trigger a new\n   execution with `start-pipeline-execution`.\n3. **Monitor the new execution** with `get-pipeline-execution` until\n   status is `Succeeded`; check each stage transition.\n4. **For cross-account fixes,** verify the trust \u002F KMS \u002F bucket policy\n   changes propagate before retrying (IAM and KMS policies are\n   eventually consistent; allow 30-60 seconds).\n\n### Step 9: Decide — ROOT_CAUSE_FOUND vs NEED_MORE_INFO vs ESCALATE\n\n- **ROOT_CAUSE_FOUND.** The walk identified a specific failure\n  category and a specific configuration element (pipeline action\n  config, CodeBuild project setting, IAM role trust, KMS key policy,\n  bucket policy, CodeBuild phase error). Output REMEDIATION with the\n  exact change.\n- **NEED_MORE_INFO.** The walk reached a step where the operator\n  cannot supply evidence (e.g., `list-action-executions` requires\n  elevated read access, or the build logs are in another account).\n  Output the list of missing inputs.\n- **ESCALATE.** The walk identifies a cause outside the operator's\n  scope: a customer-managed cross-account role owned by another team,\n  a CodeStar connection owned by a third-party org admin, an SCP\n  owned by security. Output the escalation target and the specific\n  request.\n\n## Output format\n\n```text\nINCIDENT: \u003Cpipeline name> in \u003Cregion> — \u003Cfailed stage \u002F action + symptom>\nVERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\nROOT_CAUSE: \u003Ccategory name> — \u003Cspecific failing config element>\nEVIDENCE:\n  - get-pipeline-execution: \u003Cstatus + statusSummary>\n  - list-action-executions: \u003Caction + lastStatusChangeReason>\n  - batch-get-builds: \u003CphaseStatus + failureReason, if Build>\n  - describe-stack-events: \u003CResourceStatusReason, if CFN Deploy>\n  - iam get-role \u002F simulate: \u003Ctrust policy \u002F decision>\nROOT_CAUSE_CATALOG: #\u003CN>\nREMEDIATION:\n  1. \u003Cspecific pipeline \u002F CodeBuild \u002F IAM change>\n  2. \u003Cverification command>\n  3. \u003Cpost-apply monitoring>\n```\n\n### Worked example — CodeBuild buildspec missing\n\n```text\nINCIDENT: app-build-pipeline in us-east-1 — Build stage action\n \"Build\" FAILED\nVERDICT: ROOT_CAUSE_FOUND\nROOT_CAUSE: BUILD_STAGE_FAILED — CodeBuild project \"app-build\"\n has buildspec set to \"buildspec.yml\" (default path) but the\n source artifact does not contain a buildspec.yml at the repo root;\n the DOWNLOAD_SOURCE phase succeeded but the INSTALL phase failed\n with \"buildspec not found\"\nEVIDENCE:\n  - list-action-executions: action \"Build\" in stage \"Build\",\n    lastStatus Failed, lastStatusChangeReason \"Action execution\n    failed\", externalExecutionSummary \"Build failed\"\n  - batch-get-builds id \u003Cbuild-id>: buildStatus FAILED, phases show\n    DOWNLOAD_SOURCE SUCCEEDED, INSTALL FAILED with phaseFailureReason\n    \"BUILD_CONTAINER_FAILED\"; logs show\n    \"YAML_FILE_ERROR Message: buildspec.yml is empty or missing\"\n  - get-pipeline Build action configuration: ProjectName \"app-build\",\n    no OverrideBuildspec set\n  - The source artifact (inspected via S3) contains the repo but the\n    buildspec.yml was moved to ci\u002Fbuildspec.yml in the last commit\nROOT_CAUSE_CATALOG: #5 (buildspec missing or path wrong)\nREMEDIATION:\n  1. Update the CodeBuild project to use the new buildspec path:\n     aws codebuild update-project --name app-build \\\n       --source '{type: CODEPIPELINE, buildspec: ci\u002Fbuildspec.yml, location: \"codepipeline:\u002F\u002Fapp-build-pipeline\"}'\n     Alternatively, update the pipeline action's OverrideBuildspec:\n     aws codepipeline update-pipeline --cli-json-json file:\u002F\u002Fupdated-pipeline.json\n  2. Trigger a fresh execution:\n     aws codepipeline start-pipeline-execution --name app-build-pipeline\n  3. Monitor the Build action's next execution:\n     aws codepipeline list-action-executions --pipeline-name app-build-pipeline \\\n       --query 'actionExecutionDetails[?actionName==`Build`].{status:status,reason:lastStatusChangeReason}' \\\n       --output table\n     Expect lastStatus Succeeded and a green Build stage.\n```\n\n## Expert edge cases\n\nAll eight expert edge cases (paraphrase vs logs, service-role-not-pipeline trust, KMS silent killer, change-set empty, polling vs event-driven, retry semantics, timeout layering, EventBridge signals, throttling): [Advanced patterns](references\u002Fadvanced-patterns.md).\n\n## Expert heuristic — \"Drill from the pipeline action into the service\"\n\nStage-to-real-cause lookup table and the drill-down rule: [Advanced patterns](references\u002Fadvanced-patterns.md).\n\n## Anti-Patterns — NEVER\n\n- **NEVER** treat the pipeline stage status (\"Build Failed\") as the\n  root cause. The stage is the category; the underlying service's\n  logs are the cause. Always drill.\n- **NEVER** declare `ROOT_CAUSE_FOUND` for a Build failure without\n  quoting the CodeBuild `phaseFailureReason` AND the relevant log\n  line. \"Build failed\" is the symptom, not the diagnosis.\n- **NEVER** diagnose a cross-account Deploy failure without reading\n  the customer-managed role's trust policy. `AccessDenied` in a\n  cross-account context is almost always a trust \u002F KMS \u002F bucket\n  policy issue, not a pipeline permission issue.\n- **NEVER** recommend `RetryPipelineExecution` on a pipeline whose\n  root cause is not fixed. Retry re-runs only failed actions; the\n  same input will produce the same failure.\n- **NEVER** confuse a polling source failure with an event-driven\n  trigger failure. A polling source fails inside an execution; an\n  event-driven source fails by never starting. Read\n  `PollForSourceChanges` first.\n- **NEVER** treat a CloudFormation change-set empty error as a build\n  failure. The build succeeded; the template is identical to the\n  deployed state. Check the change-set and `TemplatePath`.\n- **NEVER** recommend raising the CodeBuild timeout without first\n  reading the build logs. The cause of a 5-minute failure is in the\n  failing command, not the 60-minute cap.\n- **NEVER** add the pipeline ARN (not the role ARN) to a cross-\n  account trust policy. `sts:AssumeRole` requires an IAM principal,\n  not a pipeline resource. Use `metadata.pipelineExecutionRole`.\n- **NEVER** ignore the KMS key policy on cross-account pipelines.\n  The artifact bucket is encrypted; the customer role needs\n  `kms:Decrypt` on the key, not just `s3:GetObject` on the bucket.\n- **NEVER** declare a Source failure resolved without verifying the\n  source object \u002F branch \u002F connection actually exists post-fix.\n- **NEVER** confuse `RetryStageExecution` (re-runs only failed\n  actions) with starting a new execution. Succeeded actions are not\n  re-run; bad Source input requires a fresh execution.\n- **NEVER** rely on `CodePipeline Pipeline Execution State Change`\n  for action-level alerts. Use the underlying service's\n  state-change event (CodeBuild, CloudFormation) for action-level\n  failure notifications.\n\n## Recent AWS features (2024-2026)\n\nRecent features — pipeline rollback, FAILED_ACTIONS retry mode, GitHub v2 connections, CodeBuild fleets, EventBridge replay, V2 pipeline type: [Advanced patterns](references\u002Fadvanced-patterns.md).\n\n## References\n\nSee `references\u002Ffailure-catalog-and-decision-tree.md` for the full\nper-stage walk with worked examples per category, and\n`references\u002Fdiagnostic-commands.md` for the canonical command script\nfor each failure category.\n\n## References (load on demand)\n\n- [Advanced patterns](references\u002Fadvanced-patterns.md) — expert edge cases, drill-down heuristic, recent features\n- [Diagnostic commands](references\u002Fdiagnostic-commands.md) — per-stage diagnostic command listings and walks\n- [Failure catalog and decision tree](references\u002Ffailure-catalog-and-decision-tree.md) — per-category walk, worked examples, canonical fixes\n\n## Domain\n\nAWS CloudOps \u002F DevTools — CI\u002FCD Pipeline Reliability.\n\n## AWS documentation\n\n- **AWS CodePipeline User Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcodepipeline\u002Flatest\u002Fuserguide\u002Fwelcome.html\n- **CodePipeline pipeline executions** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcodepipeline\u002Flatest\u002Fuserguide\u002Fconcepts-how-it-works.html\n- **CodePipeline cross-account actions** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcodepipeline\u002Flatest\u002Fuserguide\u002Fsecurity-iam.html\n- **CodeBuild buildspec reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcodebuild\u002Flatest\u002Fuserguide\u002Fbuild-spec-ref.html\n- **CodeStar Connections** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fdtconsole\u002Flatest\u002Fuserguide\u002Fwelcome.html\n- **CodePipeline CLI Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fcodepipeline\u002F\n","# CodePipeline Failure Troubleshooter\n\n## Activation\n\nActivate this skill when the user reports a CodePipeline execution\nfailure. Trigger phrases: \"CodePipeline execution failed\", \"CodePipeline\naction FAILED\", \"Source stage failed\", \"Build stage failed\", \"Deploy\nstage failed\", \"CodeBuild failed\", \"buildspec missing\", \"GitHub token\nexpired\", \"CodeStar connection pending\", \"CodePipeline cross-account\",\n\"artifact bucket KMS denied\", \"approval timeout\", \"change-set empty\",\n\"CodeDeploy unhealthy\".\n\n## Mindset\n\n**One-line takeaway:** every CodePipeline execution failure has a\nspecific failed action with a `lastStatusChangeReason` and an\n`externalExecutionUrl` pointing at the underlying service's logs\n(CodeBuild logs, CloudFormation stack events, CodeDeploy deployment\nlogs, CloudTrail). The pipeline console's generic \"Failed\" is the\nsymptom — the job's own detail is the cause.\n\nThree facts make CodePipeline troubleshooting different from generic\nservice debugging:\n\n- **The pipeline's stage status is the *category*, not the cause.**\n  `Source` \u002F `Build` \u002F `Deploy` \u002F `Approval` tell you which action\n  broke. The actionable signal is the action's\n  `lastStatusChangeReason` and the `externalExecutionSummary` from\n  `list-action-executions`, plus the underlying service's logs\n  (CodeBuild logs, CloudFormation events, CodeDeploy lifecycle\n  events, CloudTrail). Always drill from the pipeline action into\n  the underlying service.\n\n- **Cross-account deployments fail at the role trust, not the\n  action.** When a Deploy action runs in account B against a stack in\n  account A, CodePipeline assumes a customer-managed role in account\n  A. If that role's trust policy does not include the pipeline's\n  service role in account B (with `sts:AssumeRole`), the action fails\n  with a misleading \"is not authorized\" error. Operators often read\n  the error as a permission issue on the action itself and miss the\n  trust policy entirely.\n\n- **Source actions can be polling or event-driven, and the failure\n  signatures differ.** A polling source that fails silently\n  (CodeCommit branch deleted, S3 source object key missing) shows up\n  as a pipeline that never starts. An event-driven source (CloudWatch\n  Events rule) that fails silently shows up as a pipeline that runs\n  the Source action but cannot fetch the artifact. Misdiagnosing the\n  trigger type leads to fixing the wrong layer.\n\n## Quick reference — stage to failure category\n\n| Failed stage \u002F action type | Failure category | First probe |\n|---|---|---|\n| Source action FAILED (CodeCommit \u002F S3 \u002F GitHub \u002F CodeStar connection) | SOURCE_STAGE_FAILED | `list-action-executions` for the Source action; read `externalExecutionSummary`. For GitHub\u002FCodeStar, check connection status. For S3, check object key. For CodeCommit, check branch exists. |\n| Build action FAILED (CodeBuild project) | BUILD_STAGE_FAILED | `batch-get-builds` on the build ID; read `buildStatus`, `phaseStatus`, and CloudWatch Logs |\n| Deploy action FAILED (CloudFormation \u002F ECS \u002F CodeDeploy \u002F S3) | DEPLOY_STAGE_FAILED | Drill into the deploy provider: CFN → `describe-stack-events`; ECS → `describe-services` \u002F `describe-tasks`; CodeDeploy → `get-deployment`; S3 → check bucket exists |\n| Approval action FAILED (Manual approval) | APPROVAL_TIMEOUT | `list-action-executions` for the Approval action; read `summary` and `lastStatusChangeReason` |\n| Cross-account Deploy FAILED with `AccessDenied` \u002F `sts:AssumeRole` | CROSS_ACCOUNT_ROLE_FAILED | Read the customer-managed cross-account role trust policy; verify `sts:AssumeRole` allows the pipeline service role |\n| Pipeline did not start at all | TRIGGER_MISCONFIGURED | Check CloudWatch Events rule target, IAM role on the rule, and source action polling config |\n\nSee the ordered steps below for the full diagnostic walk.\n\n## Quick navigation\n\n- **Step 0** — Capture the failure signal (pipeline name, region,\n  execution ID, failed stage \u002F action, lastStatusChangeReason).\n- **Step 1** — Map the failed stage to a category (A-E).\n- **Step 2** — SOURCE_STAGE_FAILED (CodeCommit, S3, GitHub,\n  CodeStar connection).\n- **Step 3** — BUILD_STAGE_FAILED (CodeBuild environment, buildspec,\n  VPC, KMS, timeout).\n- **Step 4** — DEPLOY_STAGE_FAILED (CloudFormation, ECS, CodeDeploy,\n  S3).\n- **Step 5** — APPROVAL_TIMEOUT.\n- **Step 6** — CROSS_ACCOUNT_ROLE_FAILED (trust policy, KMS policy,\n  artifact bucket policy).\n- **Step 7** — Root-cause catalog (top patterns + canonical fixes).\n- **Step 8** — Validate via retry \u002F manual replay before declaring\n  fixed.\n- **Step 9** — Decide VERDICT (ROOT_CAUSE_FOUND \u002F NEED_MORE_INFO \u002F\n  ESCALATE).\n\n## STRICT output contract\n\nEvery response MUST begin with this block — no preamble, no\nconversational opening:\n\n```text\nINCIDENT: \u003Cpipeline name> in \u003Cregion> — \u003Cfailed stage \u002F action + symptom>\nVERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\nROOT_CAUSE: \u003CSOURCE_STAGE_FAILED | BUILD_STAGE_FAILED | DEPLOY_STAGE_FAILED | APPROVAL_TIMEOUT | CROSS_ACCOUNT_ROLE_FAILED> — \u003Cone-sentence specific failing config element>\nEVIDENCE:\n  - get-pipeline-execution: \u003Cquoted PipelineExecution status + statusSummary>\n  - list-action-executions: \u003Cquoted action name, stage name, lastStatus, lastStatusChangeReason, externalExecutionSummary>\n  - get-pipeline-state: \u003Cquoted stage state + action state>\n  - batch-get-builds (if Build): \u003Cquoted buildStatus, phaseStatus, logs>\n  - describe-stack-events (if CFN Deploy): \u003Cquoted ResourceStatusReason>\n  - iam simulate-principal-policy \u002F get-role (if IAM): \u003Cdecision \u002F trust policy snippet>\nROOT_CAUSE_CATALOG: #\u003CN>\nREMEDIATION:\n  1. \u003Cexact pipeline definition change, IAM policy edit, or CLI command>\n  2. \u003Cverification command — retry the failed action>\n  3. \u003Cpost-apply monitoring step>\n```\n\n### FORBIDDEN output patterns\n\n- NEVER start with \"Let me analyze…\" or \"I'll investigate…\" — the\n  INCIDENT line is the FIRST line, always. No conversational preamble.\n- NEVER use lowercase verdict values — emit `ROOT_CAUSE_FOUND`,\n  `NEED_MORE_INFO`, or `ESCALATE`.\n- NEVER omit EVIDENCE — the judge requires direct quotes from\n  `list-action-executions` (`lastStatusChangeReason` \u002F\n  `externalExecutionSummary`) or `batch-get-builds` (`phaseStatus`,\n  log excerpts). Paraphrasing is not acceptable.\n- NEVER treat the stage name (\"Build\", \"Deploy\") as the root cause.\n  The stage is the category; the action's\n  `lastStatusChangeReason` plus the underlying service's logs are the\n  cause.\n- NEVER declare `ROOT_CAUSE_FOUND` for a cross-account Deploy failure\n  without quoting the cross-account role's trust policy AND verifying\n  the pipeline service role appears in the `Principal`.\n- NEVER recommend `RetryPipelineExecution` on a pipeline whose root\n  cause is not fixed — the retry will fail identically and consume\n  another execution.\n\n## Process — Diagnostic decision tree (apply in order)\n\n### Step 0: Capture the failure signal\n\nGather these five pieces. Each step below branches on which is present.\n\n| Signal | Source | Why required |\n|---|---|---|\n| **Pipeline name + region + execution ID** | User-provided or `aws codepipeline list-pipeline-executions` | All `get-pipeline-execution` \u002F `list-action-executions` calls need this |\n| **Failed stage + action name + lastStatusChangeReason** | `aws codepipeline list-action-executions` | Drives the category |\n| **Underlying service's logs** | `aws codebuild batch-get-builds` (Build); `aws cloudformation describe-stack-events` (CFN Deploy); `aws codedeploy get-deployment` (CodeDeploy) | The pipeline action's summary is a paraphrase; the service's logs are the verbatim cause |\n| **Pipeline definition (action configuration)** | `aws codepipeline get-pipeline` | Identifies the source type, build project, deploy provider, cross-account role |\n| **Cross-account role trust + KMS key policy (for cross-region \u002F cross-account)** | `aws iam get-role` \u002F `aws kms get-key-policy` | The most common silent failure in cross-account pipelines |\n\nIf the user has not provided the pipeline name or execution ID, emit\n`VERDICT: NEED_MORE_INFO` with the `list-pipeline-executions`\ndiscovery command and the list of missing inputs (pipeline name +\nregion, execution ID, failed stage \u002F action,\n`lastStatusChangeReason` and `externalExecutionSummary` from\n`list-action-executions`, CodeBuild build ID and logs for Build\nfailures, customer-managed role ARN for cross-account Deploy).\n\n### Step 1: Identify the failure category\n\nMap the observed failed action's stage to one of five categories.\n\n| Failed action \u002F stage | Category | Diagnostic step |\n|---|---|---|\n| Source action FAILED (CodeCommit \u002F S3 \u002F GitHub \u002F CodeStar) | **A. SOURCE_STAGE_FAILED** | Step 2 |\n| Build action FAILED (CodeBuild project) | **B. BUILD_STAGE_FAILED** | Step 3 |\n| Deploy action FAILED (CloudFormation \u002F ECS \u002F CodeDeploy \u002F S3) | **C. DEPLOY_STAGE_FAILED** | Step 4 |\n| Approval action FAILED | **D. APPROVAL_TIMEOUT** | Step 5 |\n| Deploy action FAILED with `AccessDenied` \u002F `sts:AssumeRole` \u002F cross-account | **E. CROSS_ACCOUNT_ROLE_FAILED** | Step 6 |\n| Pipeline never started | TRIGGER_MISCONFIGURED | Check the CloudWatch Events rule + the source action's `DetectionMode` |\n\n**Precedence rule.** When multiple actions in different stages fail\nin the same execution, diagnose the **earliest** failed action first —\nlater stages may have failed as a cascade because they received no\ninput artifact. Filter `list-action-executions` by `lastStatus:\nFailed`, sort by `lastUpdateTime` ascending.\n\n### Step 2: SOURCE_STAGE_FAILED diagnostic\n\nThe pipeline's Source action failed to fetch the source artifact.\n\n| Sub-symptom (read from `externalExecutionSummary` + provider) | Root cause | Probe |\n|---|---|---|\n| `The reference name \u003Cbranch> does not exist` (CodeCommit) | The configured branch was deleted or renamed in the repo | `aws codecommit get-branch --repository-name \u003Cname> --branch-name \u003Cbranch>`; update the pipeline's `BranchName` |\n| `Key does not exist` (S3 source) | The configured S3 object key was deleted or never uploaded | `aws s3api head-object --bucket \u003Cname> --key \u003Ckey>`; upload the object or update `S3ObjectKey` |\n| `The bucket does not exist` (S3 source) | The source bucket was deleted | Recreate the bucket or repoint `S3Bucket` |\n| `Could not authenticate to GitHub` \u002F `Personal access token expired` (GitHub v1 source) | The GitHub personal access token stored in Secrets Manager \u002F Parameter Store expired or was revoked | Rotate the token; update the secret; re-create the pipeline structure (GitHub v1 source action) |\n| `Connection pending` (CodeStar connection \u002F GitHub v2 \u002F Bitbucket) | The CodeStar connection was never authorised (pending handshake) | `aws codestar-connections get-connection --connection-arn \u003Carn>`; complete the connection in the console |\n| `Access denied for repository \u003Cname>` (CodeCommit) | The pipeline service role lacks `codecommit:GetRepository` \u002F `GitPull` | `iam simulate-principal-policy` on the pipeline service role |\n| Source action succeeded but pipeline never starts (polling source) | The source action is configured for polling but the polling interval is very long, or event-driven detection was disabled | Read `actionTypeId` and `configuration` for `PollForSourceChanges`; if `false`, verify the CloudWatch Events rule exists |\n\nSource-stage diagnostic commands (failed-execution discovery, failed-action listing, Source action config read): [Diagnostic commands](references\u002Fdiagnostic-commands.md).\n\nSource-stage common fix patterns (branch deleted, S3 key missing, token expired, connection pending, polling silent): [Failure catalog and decision tree](references\u002Ffailure-catalog-and-decision-tree.md).\n\n### Step 3: BUILD_STAGE_FAILED diagnostic\n\nThe pipeline's Build action invoked a CodeBuild project that returned\n`FAILED`. The pipeline console shows \"Build failed\"; the actionable\ndetail is in CodeBuild.\n\n| Sub-symptom (read from `batch-get-builds` phases + CloudWatch Logs) | Root cause | Probe |\n|---|---|---|\n| `DOWNLOAD_SOURCE` phase FAILED | CodeBuild cannot fetch the source from the artifact bucket (KMS denied, object missing, IAM role) | `batch-get-builds` phase details; check the CodeBuild service role's `s3:GetObject` and `kms:Decrypt` on the artifact bucket |\n| `INSTALL` phase FAILED with `BUILD_CONTAINER_UNABLE_TO_PULL` | The build image cannot be pulled (private ECR auth, Docker Hub rate limit, image doesn't exist) | Check `environment.image`; for ECR, ensure CodeBuild role has `ecr:BatchGetImage`; for Docker Hub, use an authenticated secret or a mirror |\n| `INSTALL` \u002F `BUILD` phase FAILED with `buildspec.yml not found` | The buildspec path is wrong, or `buildspec-location` points at a path that doesn't exist in the source | Verify `buildspec` field in the CodeBuild project; default is `buildspec.yml` at the repo root |\n| `BUILD` phase FAILED with a runtime \u002F compile error | The build script itself failed (exit code non-zero) | Read CloudWatch Logs for the failing command; the `phaseStatus` only says `FAILED` |\n| `TIMED_OUT` build status | The build exceeded `timeoutInMinutes` (default 60, max 480) | Raise `timeoutInMinutes` OR optimise the build; long builds often indicate a missing cache |\n| `COMPLETED` build but the pipeline's Build action FAILED | The CodeBuild build succeeded but failed to upload the output artifact (KMS denied on PutObject, artifact bucket missing) | Check `UPLOAD_ARTIFACTS` phase status; verify KMS key policy allows the CodeBuild role to `kms:Encrypt` |\n| VPC-enabled build FAILED with ` subnet does not exist` | The CodeBuild VPC config references a deleted subnet \u002F security group | `aws codebuild batch-get-projects`; verify the subnet IDs and SG IDs exist |\n| Environment variable `AWS_DEFAULT_REGION` mismatch | The build assumes a different region than it runs in | Set environment variables explicitly in the project |\n\nBuild-stage diagnostic walk (batch-get-builds phase query, failing-phase log retrieval): [Diagnostic commands](references\u002Fdiagnostic-commands.md).\n\nBuild-stage common fix patterns (buildspec path, KMS denied, image pull, VPC config, timeout): [Failure catalog and decision tree](references\u002Ffailure-catalog-and-decision-tree.md).\n\n### Step 4: DEPLOY_STAGE_FAILED diagnostic\n\nThe pipeline's Deploy action invoked a deploy provider (CloudFormation,\nECS, CodeDeploy, S3) that returned FAILED.\n\n| Provider | Sub-symptom | Root cause | Probe |\n|---|---|---|---|\n| CloudFormation (CFN deploy) | `No changes to deploy. The submitted changelist didn't contain any changes.` (change-set empty) | The build produced an identical template; or the change-set was created against stale state | `aws cloudformation describe-change-set` for the auto-generated change-set; verify the template differs |\n| CloudFormation (CFN deploy) | `UPDATE_FAILED` \u002F `CREATE_FAILED` (see CloudFormation troubleshooter) | The stack itself failed; the pipeline is the messenger | Drill into `describe-stack-events` (delegate to the cloudformation-stack-troubleshooter skill) |\n| CloudFormation (CFN deploy) | `TemplateURL` references a non-existent S3 object | The Build action did not produce the expected artifact, or `TemplatePath` is wrong | Verify the Build action's output artifacts include the template |\n| ECS (ECS deploy) | `Invalid task definition` \u002F `Reference does not exist` | The task definition ARN \u002F family is invalid or was deregistered | `aws ecs describe-task-definition --task-definition \u003Carn>`; verify `taskDefinitionTemplate` \u002F `imageName1` in the pipeline action config |\n| ECS (ECS deploy) | `Service did not stabilize` \u002F `running count could not be updated` | The ECS service could not reach steady state (insufficient capacity, container failure, load balancer issue) | `aws ecs describe-services`; `aws ecs describe-tasks` for stopped tasks; read stopped-reason |\n| CodeDeploy | `Deployment group unhealthy` \u002F `Too many instances with error` | CodeDeploy lifecycle hook failed; Auto Scaling Group instances failed the health check | `aws codedeploy get-deployment`; read lifecycle events per instance |\n| S3 (S3 deploy) | `The specified bucket does not exist` | Deploy bucket was deleted | Recreate or repoint |\n| S3 (S3 deploy) | `Access Denied` on `PutObject` | Pipeline service role lacks `s3:PutObject` on the deploy bucket, or bucket policy blocks it | `iam simulate-principal-policy` on the pipeline role |\n\n**Diagnostic walk:**\n\n1. **Read the deploy provider** from `get-pipeline` action\n   `actionTypeId.provider`.\n2. **Drill into the provider's logs:**\n   - CloudFormation: `describe-stack-events` (delegate to the\n     cloudformation-stack-troubleshooter skill for the root cause).\n   - ECS: `describe-services`, `describe-tasks` for stopped-reason.\n   - CodeDeploy: `get-deployment`, lifecycle events.\n   - S3: `head-bucket`, `simulate-principal-policy`.\n3. **For CloudFormation change-set empty:** the deploy action is\n   configured with `ActionMode: CREATE_UPDATE` \u002F\n   `CHANGE_SET_EXECUTE`. Verify the change-set was created from the\n   right template version; an empty change-set often means the\n   Build action produced an identical template.\n\n### Step 5: APPROVAL_TIMEOUT diagnostic\n\nThe pipeline's Approval action failed because no one approved within\nthe configured window (or the SNS topic for notifications is\nmisconfigured).\n\n| Sub-symptom | Root cause | Probe |\n|---|---|---|\n| Approval FAILED with `Timed out` | The action's `timeoutInMinutes` was hit (default 7 days, but operators often set shorter) | `list-action-executions` for the Approval action; check `timeoutInMinutes` in `get-pipeline` |\n| Approval never notified anyone | The SNS topic ARN in the Approval action is wrong, or the topic has no subscriptions | `aws sns get-topic-attributes --topic-arn \u003Carn>`; `aws sns list-subscriptions-by-topic --topic-arn \u003Carn>` |\n| Approval notification went to spam \u002F wrong email | The SNS subscription endpoint is wrong | Verify subscription endpoints |\n| Approval never appeared in the console | The action was configured with `ExternalEntityLink` only; no SNS notification was set | Add `NotificationArn` to the Approval action configuration |\n\n**Common fix patterns:**\n\n- **Timed out:** raise `timeoutInMinutes`, or improve the notification\n  target so approvers see the request promptly.\n- **SNS topic missing:** create the topic, subscribe the approvers,\n  and add `NotificationArn` to the Approval action.\n- **Re-trigger:** after extending the timeout, run\n  `RetryPipelineExecution` on the failed execution.\n\n### Step 6: CROSS_ACCOUNT_ROLE_FAILED diagnostic\n\nThe Deploy action runs in the pipeline's account (B) but deploys into\nanother account (A) via a customer-managed role. Cross-account failures\nare the most misdiagnosed because the error says \"AccessDenied\" but\nthe root cause is in account A's trust policy.\n\n| Sub-symptom | Root cause | Probe |\n|---|---|---|\n| `is not authorized to perform: sts:AssumeRole` on the customer role | The customer role's trust policy does not include the pipeline service role in account B as Principal | `aws iam get-role --role-name \u003Ccross-acct-role>` → read `AssumeRolePolicyDocument`; add the pipeline service role ARN to `Principal.AWS` |\n| `is not authorized to perform: \u003Cservice>:\u003CAction>` after AssumeRole succeeded | The customer role lacks the action on the target resource | `iam simulate-principal-policy` on the customer role in account A |\n| `KMS AccessDenied` when reading \u002F writing artifacts across accounts | The KMS key policy in account B does not grant account A's role `kms:Decrypt` \u002F `kms:Encrypt` | `aws kms get-key-policy --key-id \u003Cid> --policy-name default`; add account A's role to the key policy |\n| `AccessDenied` on `s3:GetObject` \u002F `PutObject` for the artifact bucket | The artifact bucket policy does not grant account A's role access | `aws s3api get-bucket-policy --bucket \u003Cname>`; add a statement for account A's role |\n| Cross-region Deploy FAILED | The artifact bucket in the deploy region does not exist; CodePipeline creates per-region artifact buckets but the customer role lacks cross-region permissions | Verify the customer role's policy covers the deploy region's resources |\n| Cross-account role expired (external trust with condition) | The trust policy has a `Condition` on a date or external ID that has changed | Read the trust policy's `Condition`; remove or update the stale condition |\n\nCross-account diagnostic walk (trust policy read, pipeline service-role verification, KMS key policy): [Diagnostic commands](references\u002Fdiagnostic-commands.md).\n\nCross-account common fix patterns (trust policy, KMS key policy, bucket policy, external ID): [Failure catalog and decision tree](references\u002Ffailure-catalog-and-decision-tree.md).\n\n### Step 7: Map to root-cause catalog\n\n| # | Root cause | Category | Fix pattern |\n|---|---|---|---|\n| 1 | CodeCommit branch deleted \u002F renamed | SOURCE_STAGE_FAILED | Recreate branch or update pipeline `BranchName` |\n| 2 | S3 source object key missing | SOURCE_STAGE_FAILED | Upload object; verify `S3Bucket` \u002F `S3ObjectKey` |\n| 3 | GitHub v1 token expired \u002F revoked | SOURCE_STAGE_FAILED | Rotate PAT; migrate to CodeStar connection |\n| 4 | CodeStar connection pending handshake | SOURCE_STAGE_FAILED | Complete the connection in the console |\n| 5 | `buildspec` missing or path wrong | BUILD_STAGE_FAILED | Verify `buildspec.yml` at configured path |\n| 6 | CodeBuild KMS denied on artifact bucket | BUILD_STAGE_FAILED | Add CodeBuild role to KMS key policy |\n| 7 | Build image pull failure (Docker Hub rate limit \u002F ECR auth) | BUILD_STAGE_FAILED | Use ECR mirror; grant `ecr:BatchGetImage` |\n| 8 | CodeBuild VPC config references deleted subnet \u002F SG | BUILD_STAGE_FAILED | Update `vpcConfig` with valid IDs |\n| 9 | CodeBuild `TIMED_OUT` | BUILD_STAGE_FAILED | Raise `timeoutInMinutes`; enable cache |\n| 10 | CloudFormation change-set empty | DEPLOY_STAGE_FAILED | Verify the build produced a different template; check `TemplatePath` |\n| 11 | ECS deploy `Service did not stabilize` | DEPLOY_STAGE_FAILED | `describe-tasks` stopped-reason; fix the task |\n| 12 | Approval timed out (no SNS notification) | APPROVAL_TIMEOUT | Configure `NotificationArn`; raise `timeoutInMinutes` |\n| 13 | Cross-account role trust missing pipeline service role | CROSS_ACCOUNT_ROLE_FAILED | Add pipeline role ARN to trust policy `Principal.AWS` |\n| 14 | Cross-account KMS key policy missing customer role | CROSS_ACCOUNT_ROLE_FAILED | Add customer role to KMS key policy |\n| 15 | Cross-account artifact bucket policy missing customer role | CROSS_ACCOUNT_ROLE_FAILED | Add customer role to bucket policy |\n\n### Step 8: Validate via retry \u002F replay before declaring fixed\n\nBefore declaring the fix complete:\n\n1. **Re-run the failed action via `RetryPipelineExecution`:**\n   `aws codepipeline retry-pipeline-execution --pipeline-name \u003Cname>\n   --pipeline-execution-id \u003Cid> --retry-mode FAILED_ACTIONS`.\n2. **For Source \u002F Build fixes** that change the pipeline definition,\n   apply the change with `update-pipeline`, then trigger a new\n   execution with `start-pipeline-execution`.\n3. **Monitor the new execution** with `get-pipeline-execution` until\n   status is `Succeeded`; check each stage transition.\n4. **For cross-account fixes,** verify the trust \u002F KMS \u002F bucket policy\n   changes propagate before retrying (IAM and KMS policies are\n   eventually consistent; allow 30-60 seconds).\n\n### Step 9: Decide — ROOT_CAUSE_FOUND vs NEED_MORE_INFO vs ESCALATE\n\n- **ROOT_CAUSE_FOUND.** The walk identified a specific failure\n  category and a specific configuration element (pipeline action\n  config, CodeBuild project setting, IAM role trust, KMS key policy,\n  bucket policy, CodeBuild phase error). Output REMEDIATION with the\n  exact change.\n- **NEED_MORE_INFO.** The walk reached a step where the operator\n  cannot supply evidence (e.g., `list-action-executions` requires\n  elevated read access, or the build logs are in another account).\n  Output the list of missing inputs.\n- **ESCALATE.** The walk identifies a cause outside the operator's\n  scope: a customer-managed cross-account role owned by another team,\n  a CodeStar connection owned by a third-party org admin, an SCP\n  owned by security. Output the escalation target and the specific\n  request.\n\n## Output format\n\n```text\nINCIDENT: \u003Cpipeline name> in \u003Cregion> — \u003Cfailed stage \u002F action + symptom>\nVERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE\nROOT_CAUSE: \u003Ccategory name> — \u003Cspecific failing config element>\nEVIDENCE:\n  - get-pipeline-execution: \u003Cstatus + statusSummary>\n  - list-action-executions: \u003Caction + lastStatusChangeReason>\n  - batch-get-builds: \u003CphaseStatus + failureReason, if Build>\n  - describe-stack-events: \u003CResourceStatusReason, if CFN Deploy>\n  - iam get-role \u002F simulate: \u003Ctrust policy \u002F decision>\nROOT_CAUSE_CATALOG: #\u003CN>\nREMEDIATION:\n  1. \u003Cspecific pipeline \u002F CodeBuild \u002F IAM change>\n  2. \u003Cverification command>\n  3. \u003Cpost-apply monitoring>\n```\n\n### Worked example — CodeBuild buildspec missing\n\n```text\nINCIDENT: app-build-pipeline in us-east-1 — Build stage action\n \"Build\" FAILED\nVERDICT: ROOT_CAUSE_FOUND\nROOT_CAUSE: BUILD_STAGE_FAILED — CodeBuild project \"app-build\"\n has buildspec set to \"buildspec.yml\" (default path) but the\n source artifact does not contain a buildspec.yml at the repo root;\n the DOWNLOAD_SOURCE phase succeeded but the INSTALL phase failed\n with \"buildspec not found\"\nEVIDENCE:\n  - list-action-executions: action \"Build\" in stage \"Build\",\n    lastStatus Failed, lastStatusChangeReason \"Action execution\n    failed\", externalExecutionSummary \"Build failed\"\n  - batch-get-builds id \u003Cbuild-id>: buildStatus FAILED, phases show\n    DOWNLOAD_SOURCE SUCCEEDED, INSTALL FAILED with phaseFailureReason\n    \"BUILD_CONTAINER_FAILED\"; logs show\n    \"YAML_FILE_ERROR Message: buildspec.yml is empty or missing\"\n  - get-pipeline Build action configuration: ProjectName \"app-build\",\n    no OverrideBuildspec set\n  - The source artifact (inspected via S3) contains the repo but the\n    buildspec.yml was moved to ci\u002Fbuildspec.yml in the last commit\nROOT_CAUSE_CATALOG: #5 (buildspec missing or path wrong)\nREMEDIATION:\n  1. Update the CodeBuild project to use the new buildspec path:\n     aws codebuild update-project --name app-build \\\n       --source '{type: CODEPIPELINE, buildspec: ci\u002Fbuildspec.yml, location: \"codepipeline:\u002F\u002Fapp-build-pipeline\"}'\n     Alternatively, update the pipeline action's OverrideBuildspec:\n     aws codepipeline update-pipeline --cli-json-json file:\u002F\u002Fupdated-pipeline.json\n  2. Trigger a fresh execution:\n     aws codepipeline start-pipeline-execution --name app-build-pipeline\n  3. Monitor the Build action's next execution:\n     aws codepipeline list-action-executions --pipeline-name app-build-pipeline \\\n       --query 'actionExecutionDetails[?actionName==`Build`].{status:status,reason:lastStatusChangeReason}' \\\n       --output table\n     Expect lastStatus Succeeded and a green Build stage.\n```\n\n## Expert edge cases\n\nAll eight expert edge cases (paraphrase vs logs, service-role-not-pipeline trust, KMS silent killer, change-set empty, polling vs event-driven, retry semantics, timeout layering, EventBridge signals, throttling): [Advanced patterns](references\u002Fadvanced-patterns.md).\n\n## Expert heuristic — \"Drill from the pipeline action into the service\"\n\nStage-to-real-cause lookup table and the drill-down rule: [Advanced patterns](references\u002Fadvanced-patterns.md).\n\n## Anti-Patterns — NEVER\n\n- **NEVER** treat the pipeline stage status (\"Build Failed\") as the\n  root cause. The stage is the category; the underlying service's\n  logs are the cause. Always drill.\n- **NEVER** declare `ROOT_CAUSE_FOUND` for a Build failure without\n  quoting the CodeBuild `phaseFailureReason` AND the relevant log\n  line. \"Build failed\" is the symptom, not the diagnosis.\n- **NEVER** diagnose a cross-account Deploy failure without reading\n  the customer-managed role's trust policy. `AccessDenied` in a\n  cross-account context is almost always a trust \u002F KMS \u002F bucket\n  policy issue, not a pipeline permission issue.\n- **NEVER** recommend `RetryPipelineExecution` on a pipeline whose\n  root cause is not fixed. Retry re-runs only failed actions; the\n  same input will produce the same failure.\n- **NEVER** confuse a polling source failure with an event-driven\n  trigger failure. A polling source fails inside an execution; an\n  event-driven source fails by never starting. Read\n  `PollForSourceChanges` first.\n- **NEVER** treat a CloudFormation change-set empty error as a build\n  failure. The build succeeded; the template is identical to the\n  deployed state. Check the change-set and `TemplatePath`.\n- **NEVER** recommend raising the CodeBuild timeout without first\n  reading the build logs. The cause of a 5-minute failure is in the\n  failing command, not the 60-minute cap.\n- **NEVER** add the pipeline ARN (not the role ARN) to a cross-\n  account trust policy. `sts:AssumeRole` requires an IAM principal,\n  not a pipeline resource. Use `metadata.pipelineExecutionRole`.\n- **NEVER** ignore the KMS key policy on cross-account pipelines.\n  The artifact bucket is encrypted; the customer role needs\n  `kms:Decrypt` on the key, not just `s3:GetObject` on the bucket.\n- **NEVER** declare a Source failure resolved without verifying the\n  source object \u002F branch \u002F connection actually exists post-fix.\n- **NEVER** confuse `RetryStageExecution` (re-runs only failed\n  actions) with starting a new execution. Succeeded actions are not\n  re-run; bad Source input requires a fresh execution.\n- **NEVER** rely on `CodePipeline Pipeline Execution State Change`\n  for action-level alerts. Use the underlying service's\n  state-change event (CodeBuild, CloudFormation) for action-level\n  failure notifications.\n\n## Recent AWS features (2024-2026)\n\nRecent features — pipeline rollback, FAILED_ACTIONS retry mode, GitHub v2 connections, CodeBuild fleets, EventBridge replay, V2 pipeline type: [Advanced patterns](references\u002Fadvanced-patterns.md).\n\n## References\n\nSee `references\u002Ffailure-catalog-and-decision-tree.md` for the full\nper-stage walk with worked examples per category, and\n`references\u002Fdiagnostic-commands.md` for the canonical command script\nfor each failure category.\n\n## References (load on demand)\n\n- [Advanced patterns](references\u002Fadvanced-patterns.md) — expert edge cases, drill-down heuristic, recent features\n- [Diagnostic commands](references\u002Fdiagnostic-commands.md) — per-stage diagnostic command listings and walks\n- [Failure catalog and decision tree](references\u002Ffailure-catalog-and-decision-tree.md) — per-category walk, worked examples, canonical fixes\n\n## Domain\n\nAWS CloudOps \u002F DevTools — CI\u002FCD Pipeline Reliability.\n\n## AWS documentation\n\n- **AWS CodePipeline User Guide** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcodepipeline\u002Flatest\u002Fuserguide\u002Fwelcome.html\n- **CodePipeline pipeline executions** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcodepipeline\u002Flatest\u002Fuserguide\u002Fconcepts-how-it-works.html\n- **CodePipeline cross-account actions** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcodepipeline\u002Flatest\u002Fuserguide\u002Fsecurity-iam.html\n- **CodeBuild buildspec reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcodebuild\u002Flatest\u002Fuserguide\u002Fbuild-spec-ref.html\n- **CodeStar Connections** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fdtconsole\u002Flatest\u002Fuserguide\u002Fwelcome.html\n- **CodePipeline CLI Reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fcodepipeline\u002F\n",{"name":5,"license":15,"metadata":24,"description":7,"compatibility":42},{"tags":25,"phase":26,"author":27,"domain":28,"family":29,"version":30,"keywords":31,"task_type":32,"complexity":33,"entry_point":34,"skill_class":35,"when_to_use":36,"requires_llm":37,"verdict_shape":38,"lifecycle_status":39,"invocation_schema":40,"supports_pipeline":37,"activation_triggers":41},"codepipeline, devtools, troubleshoot, pipeline-failure, codebuild, cross-account, deployment","2","Jacky Chan — AWS Community Builder","aws-cloudops","DevTools","0.1.0","CodePipeline, pipeline, execution failed, Source stage, Build stage, Deploy stage, Approval, CodeBuild, buildspec, CodeCommit, GitHub connection, CodeStar connection, cross-account, artifact bucket, KMS key policy, CloudFormation deploy, CodeDeploy, ECS deploy, CloudWatch Events, IAM role trust","troubleshoot","high","false","capability","Diagnosing why a CodePipeline execution FAILED, why a Source action failed (CodeCommit branch deleted, S3 source empty, GitHub token expired, CodeStar connection pending), why a Build action failed (CodeBuild environment error, buildspec missing, VPC config wrong, KMS denied, timeout), why a Deploy action failed (CloudFormation change-set empty, ECS task invalid, CodeDeploy unhealthy), why an Approval timed out, or why a cross-account deploy role's trust expired.","true","ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE","active","Input: either (a) a symptom description (pipeline name, region, failed stage \u002F action name, observed error from the console or CLI), OR (b) a live-account scenario where the agent runs aws codepipeline get-pipeline-execution \u002F list-action-executions \u002F get-pipeline-state \u002F get-pipeline and aws codebuild batch-get-builds to gather evidence. Output: a deterministic INCIDENT \u002F VERDICT \u002F ROOT_CAUSE \u002F EVIDENCE \u002F ROOT_CAUSE_CATALOG \u002F REMEDIATION block where VERDICT ∈ {ROOT_CAUSE_FOUND, NEED_MORE_INFO, ESCALATE} and ROOT_CAUSE names the specific failure category (SOURCE_STAGE_FAILED \u002F BUILD_STAGE_FAILED \u002F DEPLOY_STAGE_FAILED \u002F APPROVAL_TIMEOUT \u002F CROSS_ACCOUNT_ROLE_FAILED) and the offending configuration element.","CodePipeline execution failed, CodePipeline action FAILED, Source stage failed, Build stage failed, Deploy stage failed, CodeBuild failed, buildspec missing, GitHub token expired, CodeStar connection pending, CodePipeline cross-account, artifact bucket KMS denied, CodePipeline approval timeout, CloudFormation change-set empty, CodeDeploy unhealthy, CodePipeline throttled","Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline diagnosis works on supplied get-pipeline-execution \u002F list-action-executions \u002F get-pipeline-state JSON. Live-account diagnosis uses aws codepipeline get-pipeline-execution, list-action-executions, get-pipeline-state, get-pipeline, list-pipelines, aws codebuild batch-get-builds, aws cloudformation describe-stack-events (for CFN deploy stages), aws iam simulate-principal-policy, and aws logs get-log-events...","main","eeace51bd5dd1db2030729d83eeab988861553aa","skills\u002Fcodepipeline-failure-troubleshooter",0,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills","https:\u002F\u002Fgithub.com\u002Fjhkchan","CTO & Co-Founder @Beever-AI  & @votee. CAISP. AWS Community Builder. Organizer@GDGCloudHK. MongoDB Champion. Technopreneur + Infornographer.","2026-09-24 08:54:10",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add jhkchan\u002Faws-agent-skills --skill codepipeline-failure-troubleshooter",{"tool":57,"command":58},"bunx","bunx skills add jhkchan\u002Faws-agent-skills --skill codepipeline-failure-troubleshooter",{"tool":60,"command":61},"pnpm","pnpm dlx skills add jhkchan\u002Faws-agent-skills --skill codepipeline-failure-troubleshooter","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002FSKILL.md",true,[65,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,135],{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"eval\u002Ftest-cases.yaml","REFERENCE","参考文档",5901,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Feval\u002Ftest-cases.yaml",{"path":72,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":73,"sourceHtmlUrl":74},"evals\u002Fbaselines\u002Fcp-build-buildspec-missing.md",730,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fbaselines\u002Fcp-build-buildspec-missing.md",{"path":76,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":77,"sourceHtmlUrl":78},"evals\u002Fbaselines\u002Fcp-cross-account-role-trust-expired.md",807,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fbaselines\u002Fcp-cross-account-role-trust-expired.md",{"path":80,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":81,"sourceHtmlUrl":82},"evals\u002Fbaselines\u002Fcp-deploy-cfn-changeset-empty.md",841,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fbaselines\u002Fcp-deploy-cfn-changeset-empty.md",{"path":84,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":85,"sourceHtmlUrl":86},"evals\u002Fbaselines\u002Fcp-source-github-token-expired.md",733,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fbaselines\u002Fcp-source-github-token-expired.md",{"path":88,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":89,"sourceHtmlUrl":90},"evals\u002Fbaselines\u002Fcp-vague-report-need-pipeline-info.md",610,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fbaselines\u002Fcp-vague-report-need-pipeline-info.md",{"path":92,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":93,"sourceHtmlUrl":94},"evals\u002Feval_config.yaml",2081,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Feval_config.yaml",{"path":96,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":97,"sourceHtmlUrl":98},"evals\u002Fevals.json",4905,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fevals.json",{"path":100,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":101,"sourceHtmlUrl":102},"evals\u002Fprompts\u002Fcp-build-buildspec-missing.md",1520,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fprompts\u002Fcp-build-buildspec-missing.md",{"path":104,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":105,"sourceHtmlUrl":106},"evals\u002Fprompts\u002Fcp-cross-account-role-trust-expired.md",1742,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fprompts\u002Fcp-cross-account-role-trust-expired.md",{"path":108,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":109,"sourceHtmlUrl":110},"evals\u002Fprompts\u002Fcp-deploy-cfn-changeset-empty.md",1460,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fprompts\u002Fcp-deploy-cfn-changeset-empty.md",{"path":112,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":113,"sourceHtmlUrl":114},"evals\u002Fprompts\u002Fcp-source-github-token-expired.md",1366,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fprompts\u002Fcp-source-github-token-expired.md",{"path":116,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":117,"sourceHtmlUrl":118},"evals\u002Fprompts\u002Fcp-vague-report-need-pipeline-info.md",789,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fevals\u002Fprompts\u002Fcp-vague-report-need-pipeline-info.md",{"path":120,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":121,"sourceHtmlUrl":122},"examples\u002FREADME.md",6398,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fexamples\u002FREADME.md",{"path":124,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":125,"sourceHtmlUrl":126},"references\u002Fadvanced-patterns.md",6638,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Freferences\u002Fadvanced-patterns.md",{"path":128,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":129,"sourceHtmlUrl":130},"references\u002Fdiagnostic-commands.md",11196,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Freferences\u002Fdiagnostic-commands.md",{"path":132,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":133,"sourceHtmlUrl":134},"references\u002Ffailure-catalog-and-decision-tree.md",16529,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Freferences\u002Ffailure-catalog-and-decision-tree.md",{"path":136,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":137,"sourceHtmlUrl":138},"skill.usf.yaml",4560,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fcodepipeline-failure-troubleshooter\u002Fskill.usf.yaml",[140,147,154,161,168,175],{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":19},"01M7ADVD60X4PCAPKSE58P9NDC","xray-tracing-deployer","Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL \u002F method \u002F service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry \u002F ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS \u002F EKS \u002F Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxray-tracing-deployer\u002FSKILL.md",[],[],{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":153,"publishedAt":19},"01M7ADTVJ7DCBM9CB1FY51GH7J","wellarchitected-workload-auditor","Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-workload-auditor\u002FSKILL.md",[],[],{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":160,"publishedAt":19},"01M7ADT59G6FTTNZYHT2QRPNNP","wellarchitected-review-operator","Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer \u002F get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-review-operator\u002FSKILL.md",[],[],{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":167,"publishedAt":19},"01M7ADSH5JA9QHNPPHQCD7EVA7","wafv2-web-acl-deployer","Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB\u002FAPI Gateway\u002FCloudFront, or configuring CAPTCHA\u002FChallenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-deployer\u002FSKILL.md",[],[],{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":172,"categories":173,"keywords":174,"publishedAt":19},"01M7ADRYFAT8R73FBNCHRC573X","wafv2-web-acl-auditor","Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow\u002Fbypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-auditor\u002FSKILL.md",[],[],{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":181,"publishedAt":19},"01M7ADR8W7G72JX4KFGN03QK8Q","waf-rule-deployer","Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwaf-rule-deployer\u002FSKILL.md",[],[]]