ABCA Troubleshooting
You are diagnosing an issue with the ABCA platform. Follow a systematic approach: gather symptoms, check the most common causes, and apply targeted fixes.
Running the CLI: commands below call node cli/lib/bin/bgagent.js …. In a non-interactive or mise-managed shell node may not be on PATH — prefix with mise exec --. Ironically, node: command not found is itself a common symptom (the shell hasn't activated mise); that's a missing prefix, not a broken install.
Step 1: Identify the Problem Category
Determine which area the issue falls into:
- Build/Compilation — TypeScript errors, test failures, lint issues
- Deployment — CDK deploy/synth failures, CloudFormation errors
- Authentication — Cognito errors, token issues, 401 responses
- Task Submission — 422 errors, validation failures, guardrail blocks
- Task Execution — Preflight failures, agent failures, timeouts
- Local Agent Testing — Docker issues, run.sh problems
Build/Compilation Issues
export MISE_EXPERIMENTAL=1
mise //cdk:compile 2>&1 | tail -50 # TypeScript errors
mise //cdk:test 2>&1 | tail -50 # Test failures
Common causes:
- Missing
mise run install after pulling changes
yarn: command not found — Run corepack enable && corepack prepare yarn@1.22.22 --activate
- Type mismatches after editing
cdk/src/handlers/shared/types.ts without updating cli/src/types.ts
Deployment Issues
# Check CloudFormation events for the failed stack
aws cloudformation describe-stack-events --stack-name backgroundagent-dev \
--query 'StackEvents[?ResourceStatus==`CREATE_FAILED` || ResourceStatus==`UPDATE_FAILED`].[LogicalResourceId,ResourceStatusReason]' \
--output table
Common causes:
- Docker not running — Required for CDK asset bundling
- Missing CDK bootstrap — Run
mise //cdk:bootstrap
- IAM permission issues — Check
aws sts get-caller-identity
- Region mismatch — Ensure consistent region across all commands
Authentication Issues
# Verify credentials
aws sts get-caller-identity
# Check Cognito user exists
aws cognito-idp admin-get-user \
--user-pool-id $USER_POOL_ID \
--username user@example.com
Common causes:
- "App client does not exist" — Region mismatch between CLI config and stack deployment
- Token expired — Re-authenticate with
bgagent login
- 401 on API calls — Token not included or malformed in Authorization header
- User not created — Self-signup is disabled; admin must create users
Task Submission Issues (422 / 400)
"Repository not onboarded" / REPO_NOT_ONBOARDED (422):
- The repo isn't registered. Fastest fix:
bgagent repo onboard <owner/repo> (operator path — writes the RepoTable record at runtime, no redeploy). A CDK Blueprint is only needed for declarative config. Use the onboard-repo skill for details.
- Also confirm the
owner/repo matches exactly what you pass to bgagent submit --repo.
"GUARDRAIL_BLOCKED" (400):
- Task description triggered Bedrock Guardrails content screening
- Review and rephrase the task description to remove potentially flagged content
Validation errors:
- Check required fields:
repo is required, plus at least one of issue_number, task_description, pr_number
max_turns range: 1-500
max_budget_usd range: $0.01-$100
Task Execution Issues
# Check task events for details
node cli/lib/bin/bgagent.js events <TASK_ID> --output json
preflight_failed:
- GitHub PAT lacks permissions for the repo
- Repository doesn't exist or is private without proper token scope
- Check event
reason and detail fields for specifics
- Verify PAT: fine-grained token must include the target repository with Contents (read/write), Pull Requests (read/write), Issues (read)
task_failed / task completes with 0 tokens and no PR:
403 "not authorized to perform bedrock:InvokeModelWithResponseStream":
- The repo's
model_id is a model the runtime IAM role wasn't granted. The runtime only has grantInvoke for the models in the stack's configured set — read it from the BedrockModelIds stack output rather than a list here (Sonnet 4.6, Opus 4.8, Opus 5, Haiku 4.5 by default).
- Quick fix: point the repo at an already-granted model —
bgagent repo onboard <owner/repo> --model global.anthropic.claude-opus-5 (no redeploy).
- To add a new model to the runtime: grant it in the stack and redeploy. The model set is the shared list in
cdk/src/constructs/bedrock-models.ts — add the model via the bedrockModels CDK context (cdk.json) so both the AgentCore and ECS backends grant it (#433). Adding a model also requires account-level Bedrock access for it (separate from IAM — see the next row).
Model not enabled / "not available on your Bedrock deployment" (often immediate failure, few turns, zero or near-zero tokens):
- IAM is necessary but not sufficient. The AgentCore role may already have
bedrock:InvokeModel*, but the account must also satisfy Amazon Bedrock model access: Marketplace subscription flow on first serverless use (with aws-marketplace:Subscribe / ViewSubscriptions where needed), Anthropic first-time use details (PutUseCaseForModelAccess or the console model catalog), and a valid payment method for Marketplace-backed models.
- Use an inference profile ID in the Blueprint / DynamoDB
model_id when Bedrock requires it for on-demand invocation (for example global.anthropic.claude-opus-5 for global Opus 5). See Use an inference profile in model invocation. Raw anthropic.* IDs often hit "on-demand not supported" or wrong routing — see the 400 row below.
- Cross-Region profiles route across Regions in a geography; ensure IAM and any SCPs allow Bedrock in all destination Regions for that profile. See Supported Regions and models for inference profiles.
- Task status: When the Claude CLI reports a terminal error via
ResultMessage.is_error, the agent marks the task FAILED (not COMPLETED) and persists error_message in DynamoDB.
400 "Invocation with on-demand throughput isn't supported":
- The Blueprint
modelId uses a raw foundation model ID (e.g. anthropic.claude-opus-4-8)
- Fix: change to the inference profile ID, prefixed with the geography the stack grants —
its
BedrockGeoRegion output (e.g. global.anthropic.claude-opus-4-8) — then update
DynamoDB via redeploy. A prefix from a different geography raises AccessDenied
rather than this 400, since the IAM grant is scoped per geography.
503 "Too many connections" / task completes with 0 tokens after long duration:
- Bedrock is throttling model invocations. The agent retries for minutes then gives up.
- Symptoms: task runs for 10-15 minutes, may end with
COMPLETED if the SDK does not flag ResultMessage.is_error (unlike hard Bedrock entitlement errors, which surface as FAILED once the CLI sets is_error on the result)
- Diagnosis:
- Check application logs for
"text": "API Error: 503 Too many connections"
- Check what model_id is actually being passed — the DynamoDB record may have a stale model override:
aws dynamodb get-item \
--table-name <RepoTableName> \
--key '{"repo": {"S": "owner/repo"}}' \
--query 'Item.model_id' --output text
- Causes:
- Stale model_id in DynamoDB (most common) — the Blueprint
onUpdate only sets fields present in props; removing a modelId prop does NOT remove the field from DynamoDB. The task keeps using the old model.
- Bedrock service-level throttling for the specific model (Opus-class models have tighter limits than Sonnet or Haiku)
- Account quota limits reached
- Fix:
- Check and fix the DynamoDB record first — remove stale
model_id if present:aws dynamodb update-item \
--table-name <RepoTableName> \
--key '{"repo": {"S": "owner/repo"}}' \
--update-expression "REMOVE model_id"
- If model_id is correct, wait and retry — throttling is often transient
- Switch to a model with higher availability (Haiku 4.5 > Sonnet 4.6 > Opus)
- Request a Bedrock quota increase for
InvokeModel RPM on your model
task_timed_out:
- 9-hour maximum exceeded
- Consider reducing scope or increasing
max_turns for complex tasks
- Check if the agent is stuck in a loop (review logs)
Concurrency limit:
- Default: 3 concurrent tasks per user
- Wait for running tasks to complete or cancel them
Local Agent Testing Issues
# Verify Docker is running
docker info
# Test locally with dry run
DRY_RUN=1 ./agent/run.sh "owner/repo" "Test task"
Common causes:
- Missing environment variables:
GITHUB_TOKEN, AWS_REGION
- Docker not running or insufficient resources (needs 2 vCPU, 8 GB RAM)
- Missing AWS credentials for Bedrock access
Diagnostic Commands Quick Reference
# Stack status
aws cloudformation describe-stacks --stack-name backgroundagent-dev --query 'Stacks[0].StackStatus'
# Stack outputs
aws cloudformation describe-stacks --stack-name backgroundagent-dev --query 'Stacks[0].Outputs' --output table
# Task status (use --verbose for HTTP-level debug output)
node cli/lib/bin/bgagent.js --verbose status <TASK_ID>
node cli/lib/bin/bgagent.js events <TASK_ID> --output json
# Watch task progress in real time
node cli/lib/bin/bgagent.js watch <TASK_ID>
# Download full execution trace (task must have been submitted with --trace)
node cli/lib/bin/bgagent.js trace download <TASK_ID>
# List running tasks
node cli/lib/bin/bgagent.js list --status RUNNING
# Build health
mise run build
Tip: Add --verbose to any bgagent command to see the full HTTP request/response cycle on stderr. This is the fastest way to diagnose auth, network, or API contract issues.
1---2name: troubleshoot3description: Diagnose and fix common ABCA issues: deployment failures, preflight errors, authentication problems, agent failures, and build issues. Use when the user says "troubleshoot", "debug", "not working", "error", "failed", "help me fix", "preflight_failed", "task failed", "deploy failed", "auth error", "401", "422", "503", or describes something not working as expected.4---56# ABCA Troubleshooting78You are diagnosing an issue with the ABCA platform. Follow a systematic approach: gather symptoms, check the most common causes, and apply targeted fixes.910> **Running the CLI:** commands below call `node cli/lib/bin/bgagent.js …`. In a non-interactive or mise-managed shell `node` may not be on `PATH` — prefix with `mise exec --`. Ironically, `node: command not found` is itself a common symptom (the shell hasn't activated mise); that's a missing prefix, not a broken install.1112## Step 1: Identify the Problem Category1314Determine which area the issue falls into:15161. **Build/Compilation** — TypeScript errors, test failures, lint issues172. **Deployment** — CDK deploy/synth failures, CloudFormation errors183. **Authentication** — Cognito errors, token issues, 401 responses194. **Task Submission** — 422 errors, validation failures, guardrail blocks205. **Task Execution** — Preflight failures, agent failures, timeouts216. **Local Agent Testing** — Docker issues, run.sh problems2223## Build/Compilation Issues2425```bash26export MISE_EXPERIMENTAL=127mise //cdk:compile 2>&1 | tail -50 # TypeScript errors28mise //cdk:test 2>&1 | tail -50 # Test failures29```3031**Common causes:**32- Missing `mise run install` after pulling changes33- `yarn: command not found` — Run `corepack enable && corepack prepare yarn@1.22.22 --activate`34- Type mismatches after editing `cdk/src/handlers/shared/types.ts` without updating `cli/src/types.ts`3536## Deployment Issues3738```bash39# Check CloudFormation events for the failed stack40aws cloudformation describe-stack-events --stack-name backgroundagent-dev \41 --query 'StackEvents[?ResourceStatus==`CREATE_FAILED` || ResourceStatus==`UPDATE_FAILED`].[LogicalResourceId,ResourceStatusReason]' \42 --output table43```4445**Common causes:**46- Docker not running — Required for CDK asset bundling47- Missing CDK bootstrap — Run `mise //cdk:bootstrap`48- IAM permission issues — Check `aws sts get-caller-identity`49- Region mismatch — Ensure consistent region across all commands5051## Authentication Issues5253```bash54# Verify credentials55aws sts get-caller-identity5657# Check Cognito user exists58aws cognito-idp admin-get-user \59 --user-pool-id $USER_POOL_ID \60 --username user@example.com61```6263**Common causes:**64- "App client does not exist" — Region mismatch between CLI config and stack deployment65- Token expired — Re-authenticate with `bgagent login`66- 401 on API calls — Token not included or malformed in Authorization header67- User not created — Self-signup is disabled; admin must create users6869## Task Submission Issues (422 / 400)7071**"Repository not onboarded" / `REPO_NOT_ONBOARDED` (422):**72- The repo isn't registered. Fastest fix: `bgagent repo onboard <owner/repo>` (operator path — writes the RepoTable record at runtime, no redeploy). A CDK Blueprint is only needed for declarative config. Use the `onboard-repo` skill for details.73- Also confirm the `owner/repo` matches **exactly** what you pass to `bgagent submit --repo`.7475**"GUARDRAIL_BLOCKED" (400):**76- Task description triggered Bedrock Guardrails content screening77- Review and rephrase the task description to remove potentially flagged content7879**Validation errors:**80- Check required fields: `repo` is required, plus at least one of `issue_number`, `task_description`, `pr_number`81- `max_turns` range: 1-50082- `max_budget_usd` range: $0.01-$1008384## Task Execution Issues8586```bash87# Check task events for details88node cli/lib/bin/bgagent.js events <TASK_ID> --output json89```9091**`preflight_failed`:**92- GitHub PAT lacks permissions for the repo93- Repository doesn't exist or is private without proper token scope94- Check event `reason` and `detail` fields for specifics95- Verify PAT: fine-grained token must include the target repository with Contents (read/write), Pull Requests (read/write), Issues (read)9697**`task_failed` / task completes with 0 tokens and no PR:**98- Agent encountered an error during execution99- Check CloudWatch logs for the session:100 ```bash101 aws logs filter-log-events \102 --log-group-name "/aws/vendedlogs/bedrock-agentcore/runtime/APPLICATION_LOGS/jean_cloude" \103 --filter-pattern "<TASK_ID>" \104 --region us-west-2 --query 'events[*].message' --output text105 ```106- Common: repo build/test commands not documented in CLAUDE.md107108**403 "not authorized to perform bedrock:InvokeModelWithResponseStream":**109- The repo's `model_id` is a model the runtime IAM role wasn't granted. The runtime only has `grantInvoke` for the models in the stack's configured set — read it from the `BedrockModelIds` stack output rather than a list here (Sonnet 4.6, Opus 4.8, Opus 5, Haiku 4.5 by default).110- **Quick fix:** point the repo at an already-granted model — `bgagent repo onboard <owner/repo> --model global.anthropic.claude-opus-5` (no redeploy).111- **To add a new model to the runtime:** grant it in the stack and redeploy. The model set is the shared list in `cdk/src/constructs/bedrock-models.ts` — add the model via the `bedrockModels` CDK context (`cdk.json`) so both the AgentCore and ECS backends grant it (#433). Adding a model also requires **account-level Bedrock access** for it (separate from IAM — see the next row).112113**Model not enabled / "not available on your Bedrock deployment" (often immediate failure, few turns, zero or near-zero tokens):**114- **IAM is necessary but not sufficient.** The AgentCore role may already have `bedrock:InvokeModel*`, but the **account** must also satisfy [Amazon Bedrock model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html): Marketplace subscription flow on first serverless use (with `aws-marketplace:Subscribe` / `ViewSubscriptions` where needed), Anthropic **first-time use** details (`PutUseCaseForModelAccess` or the console model catalog), and a valid payment method for Marketplace-backed models.115- **Use an inference profile ID** in the Blueprint / DynamoDB `model_id` when Bedrock requires it for on-demand invocation (for example `global.anthropic.claude-opus-5` for global Opus 5). See [Use an inference profile in model invocation](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-use.html). Raw `anthropic.*` IDs often hit "on-demand not supported" or wrong routing — see the **400** row below.116- **Cross-Region profiles** route across Regions in a geography; ensure IAM and any SCPs allow Bedrock in **all destination Regions** for that profile. See [Supported Regions and models for inference profiles](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html).117- **Task status:** When the Claude CLI reports a terminal error via `ResultMessage.is_error`, the agent marks the task **FAILED** (not COMPLETED) and persists `error_message` in DynamoDB.118119**400 "Invocation with on-demand throughput isn't supported":**120- The Blueprint `modelId` uses a raw foundation model ID (e.g. `anthropic.claude-opus-4-8`)121- Fix: change to the inference profile ID, prefixed with the geography the stack grants —122 its `BedrockGeoRegion` output (e.g. `global.anthropic.claude-opus-4-8`) — then update123 DynamoDB via redeploy. A prefix from a *different* geography raises `AccessDenied`124 rather than this 400, since the IAM grant is scoped per geography.125126**503 "Too many connections" / task completes with 0 tokens after long duration:**127- Bedrock is throttling model invocations. The agent retries for minutes then gives up.128- Symptoms: task runs for 10-15 minutes, may end with `COMPLETED` if the SDK does not flag `ResultMessage.is_error` (unlike hard Bedrock entitlement errors, which surface as **FAILED** once the CLI sets `is_error` on the result)129- Diagnosis:130 1. Check application logs for `"text": "API Error: 503 Too many connections"`131 2. **Check what model_id is actually being passed** — the DynamoDB record may have a stale model override:132 ```bash133 aws dynamodb get-item \134 --table-name <RepoTableName> \135 --key '{"repo": {"S": "owner/repo"}}' \136 --query 'Item.model_id' --output text137 ```138- Causes:139 - **Stale model_id in DynamoDB** (most common) — the Blueprint `onUpdate` only sets fields present in props; removing a `modelId` prop does NOT remove the field from DynamoDB. The task keeps using the old model.140 - Bedrock service-level throttling for the specific model (Opus-class models have tighter limits than Sonnet or Haiku)141 - Account quota limits reached142- Fix:143 1. **Check and fix the DynamoDB record first** — remove stale `model_id` if present:144 ```bash145 aws dynamodb update-item \146 --table-name <RepoTableName> \147 --key '{"repo": {"S": "owner/repo"}}' \148 --update-expression "REMOVE model_id"149 ```150 2. If model_id is correct, wait and retry — throttling is often transient151 3. Switch to a model with higher availability (Haiku 4.5 > Sonnet 4.6 > Opus)152 4. Request a Bedrock quota increase for `InvokeModel` RPM on your model153154**`task_timed_out`:**155- 9-hour maximum exceeded156- Consider reducing scope or increasing `max_turns` for complex tasks157- Check if the agent is stuck in a loop (review logs)158159**Concurrency limit:**160- Default: 3 concurrent tasks per user161- Wait for running tasks to complete or cancel them162163## Local Agent Testing Issues164165```bash166# Verify Docker is running167docker info168169# Test locally with dry run170DRY_RUN=1 ./agent/run.sh "owner/repo" "Test task"171```172173**Common causes:**174- Missing environment variables: `GITHUB_TOKEN`, `AWS_REGION`175- Docker not running or insufficient resources (needs 2 vCPU, 8 GB RAM)176- Missing AWS credentials for Bedrock access177178## Diagnostic Commands Quick Reference179180```bash181# Stack status182aws cloudformation describe-stacks --stack-name backgroundagent-dev --query 'Stacks[0].StackStatus'183184# Stack outputs185aws cloudformation describe-stacks --stack-name backgroundagent-dev --query 'Stacks[0].Outputs' --output table186187# Task status (use --verbose for HTTP-level debug output)188node cli/lib/bin/bgagent.js --verbose status <TASK_ID>189node cli/lib/bin/bgagent.js events <TASK_ID> --output json190191# Watch task progress in real time192node cli/lib/bin/bgagent.js watch <TASK_ID>193194# Download full execution trace (task must have been submitted with --trace)195node cli/lib/bin/bgagent.js trace download <TASK_ID>196197# List running tasks198node cli/lib/bin/bgagent.js list --status RUNNING199200# Build health201mise run build202```203204**Tip:** Add `--verbose` to any `bgagent` command to see the full HTTP request/response cycle on stderr. This is the fastest way to diagnose auth, network, or API contract issues.