openclaw - ✅(Solved) Fix auth-profiles.json rejects "type": "aws-sdk" as invalid_type since 2026.4.1 — breaks Bedrock on EC2 (IMDS) [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#69708Fetched 2026-04-22 07:49:10
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1

Since OpenClaw 2026.4.1, the gateway rejects "type": "aws-sdk" entries in auth-profiles.json with invalid_type, silently dropping the amazon-bedrock:default profile. This breaks AWS Bedrock authentication on EC2 instances that rely on IMDS (instance metadata) credentials.

The gateway logs show no obvious error — just a subtle line at startup:

[agents/auth-profiles] ignored invalid auth profile entries during store load

With --verbose, the actual rejection is visible:

"dropped": 1, "reasons": {"invalid_type": 1}, "keys": ["amazon-bedrock:default"]

Error Message

The gateway logs show no obvious error — just a subtle line at startup:

Root Cause

Since OpenClaw 2026.4.1, the gateway rejects "type": "aws-sdk" entries in auth-profiles.json with invalid_type, silently dropping the amazon-bedrock:default profile. This breaks AWS Bedrock authentication on EC2 instances that rely on IMDS (instance metadata) credentials.

The gateway logs show no obvious error — just a subtle line at startup:

[agents/auth-profiles] ignored invalid auth profile entries during store load

With --verbose, the actual rejection is visible:

"dropped": 1, "reasons": {"invalid_type": 1}, "keys": ["amazon-bedrock:default"]

Fix Action

Workaround

Delete auth-profiles.json for all agents and prevent it from being regenerated. Without auth-profiles, the gateway falls back to the provider-level "auth": "aws-sdk" config in openclaw.json and the default SDK credential chain works correctly.

rm ~/.openclaw/agents/*/agent/auth-profiles.json

PR fix notes

PR #69753: fix(auth-profiles): silently skip aws-sdk SDK-managed markers during store load

Description (problem / solution / changelog)

Problem

Since 2026.4.1, auth-profiles.json entries with `"type": "aws-sdk"` are rejected as `invalid_type` and dropped during store load. This silently breaks Amazon Bedrock on EC2 instances that rely on IMDS (instance metadata) credentials — the gateway logs a generic "ignored invalid auth profile entries" warning, and Bedrock calls then fail with `DispatchFailure: Could not load credentials from any providers`.

Reported by @allamand in #69708 with complete EC2/IMDS repro.

Fix

`aws-sdk` is not a real credential variant — it's a marker that records the presence of a Bedrock profile while letting the AWS SDK resolve credentials independently at call time via its own chain (env vars, shared config, IMDS, etc.). The marker should be accepted silently, not rejected.

Introduce `AUTH_PROFILE_SDK_MARKER_TYPES = new Set(["aws-sdk"])` and short-circuit `parseCredentialEntry` to return `sdk_marker_skipped` (a new reason code) for any marker type. The "invalid entries" warning filters these out so genuine invalid entries remain visible in the log.

Why not widen `AuthProfileCredential` instead

Adding a real `AwsSdkCredential` variant to the union would require adjusting ~10 downstream type-narrowing switches (`credential-state.ts`, `oauth.ts`, `persisted.ts` migration path, etc.). That's a larger surface than the fix requires — the marker has no secret material for any of those switches to do anything with. The narrower "skip silently" shape both unblocks Bedrock and keeps the change scoped to one file of behavior.

Pre-implement audit

  • A (existing helper): `AUTH_PROFILE_TYPES` set already drives the allow/reject boundary. Added a parallel `AUTH_PROFILE_SDK_MARKER_TYPES` for non-credential markers rather than shoehorning into the credential type union. ✓
  • B (shared callers): The parse helper is called from every auth-profile load path. The behavior change is strictly narrower (a previously-rejected marker is now cleanly skipped) — no switch downstream needs a new branch. ✓
  • C (broader rival): No rival on #69708. ✓

Testing

Two new regression tests in `auth-profiles.ensureauthprofilestore.test.ts`:

  • `silently skips SDK-managed marker profiles (#69708)` — aws-sdk + a real api_key entry: asserts the marker is absent from the loaded store AND no warning is logged.
  • `still warns about genuine invalid types alongside SDK markers (#69708)` — mixes an aws-sdk marker with a truly-invalid entry: asserts the warning surfaces only the real invalid entry (dropped: 1, reasons: {invalid_type: 1}), not inflated by the marker.

tsc clean on touched files, oxlint clean.

Fixes #69708

Changed files

  • src/agents/auth-profiles.ensureauthprofilestore.test.ts (modified, +82/-0)
  • src/agents/auth-profiles/persisted.ts (modified, +40/-5)

Code Example

[agents/auth-profiles] ignored invalid auth profile entries during store load

---

"dropped": 1, "reasons": {"invalid_type": 1}, "keys": ["amazon-bedrock:default"]

---

{
     "amazon-bedrock:default": {
       "type": "aws-sdk",
       "createdAt": "2026-03-15T10:00:00.000Z"
     }
   }

---

DispatchFailure: Could not load credentials from any providers

---

rm ~/.openclaw/agents/*/agent/auth-profiles.json
RAW_BUFFERClick to expand / collapse

Summary

Since OpenClaw 2026.4.1, the gateway rejects "type": "aws-sdk" entries in auth-profiles.json with invalid_type, silently dropping the amazon-bedrock:default profile. This breaks AWS Bedrock authentication on EC2 instances that rely on IMDS (instance metadata) credentials.

The gateway logs show no obvious error — just a subtle line at startup:

[agents/auth-profiles] ignored invalid auth profile entries during store load

With --verbose, the actual rejection is visible:

"dropped": 1, "reasons": {"invalid_type": 1}, "keys": ["amazon-bedrock:default"]

Steps to reproduce

  1. Deploy OpenClaw on an EC2 instance with an IAM role that has Bedrock access
  2. Configure openclaw.json with a Bedrock provider using "auth": "aws-sdk"
  3. Have an auth-profiles.json with:
    {
      "amazon-bedrock:default": {
        "type": "aws-sdk",
        "createdAt": "2026-03-15T10:00:00.000Z"
      }
    }
  4. Start the gateway
  5. Send a message that routes to Bedrock

Expected behavior

The gateway should accept "type": "aws-sdk" auth profiles and use the default AWS SDK credential chain (environment → config → IMDS) to authenticate Bedrock requests.

Actual behavior

The gateway silently drops the amazon-bedrock:default profile as invalid_type. Subsequent Bedrock requests fail with:

DispatchFailure: Could not load credentials from any providers

This happens even though:

  • IMDS is accessible and returns valid credentials (curl http://169.254.169.254/... works)
  • AWS CLI on the same host works fine (aws sts get-caller-identity succeeds)
  • The @smithy/credential-provider-imds package is present in node_modules
  • IMDSv2 hop limit is set to 2

Workaround

Delete auth-profiles.json for all agents and prevent it from being regenerated. Without auth-profiles, the gateway falls back to the provider-level "auth": "aws-sdk" config in openclaw.json and the default SDK credential chain works correctly.

rm ~/.openclaw/agents/*/agent/auth-profiles.json

Environment

  • OpenClaw version: 2026.4.1
  • OS: Amazon Linux 2023 (EC2, eu-west-3)
  • Install method: npm global
  • Node: v22.x
  • Provider: amazon-bedrock (via bedrock-converse-stream)
  • Auth mode: AWS IAM role via IMDS (EC2 instance profile)
  • IMDSv2 hop limit: 2

Related issues

  • #27901 — auth-profiles.json silently overwritten/reset after upgrades
  • #12003 — sub-agents fail when credentials not persisted to auth-profiles.json
  • #12685 — config mode/type mismatch + token not synced to non-main agents

extent analysis

TL;DR

The gateway can be fixed by removing the auth-profiles.json file to fall back to the provider-level "auth": "aws-sdk" config.

Guidance

  • Verify that the auth-profiles.json file is the cause of the issue by checking the gateway logs with --verbose for the "dropped" and "reasons" messages.
  • Remove the auth-profiles.json file for all agents using the command rm ~/.openclaw/agents/*/agent/auth-profiles.json to prevent it from being regenerated.
  • Confirm that the default AWS SDK credential chain works correctly by checking the gateway logs and testing Bedrock requests.
  • Consider monitoring related issues (#27901, #12003, #12685) for potential future fixes or workarounds.

Example

No code snippet is necessary in this case, as the workaround involves removing a file.

Notes

This workaround may not be suitable for all environments, especially those that rely on custom auth profiles. It's essential to test and verify the fix in a non-production environment before applying it to production.

Recommendation

Apply the workaround by removing the auth-profiles.json file, as it allows the gateway to fall back to the provider-level "auth": "aws-sdk" config and use the default SDK credential chain.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The gateway should accept "type": "aws-sdk" auth profiles and use the default AWS SDK credential chain (environment → config → IMDS) to authenticate Bedrock requests.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING