coleam00/Archon · error

Vendor '${vendor}' uses ambient cloud credentials and has no

Error message

Vendor '${vendor}' uses ambient cloud credentials and has no stored-credential delivery.

What it means

Thrown by deliverCredential when a stored credential row targets a vendor in PI_AMBIENT_VENDORS (e.g. amazon-bedrock) that is detected from the environment and has no env-var delivery rule. Ambient-only vendors are never connectable and never stored, so a stored row means something wrote one incorrectly — the delivery layer refuses rather than silently dropping the credential.

Source

Thrown at packages/core/src/credentials/delivery.ts:208

      // takes precedence over the ambient check.
      const piEnvVar = PI_PROVIDER_ENV_VARS[vendor];
      if (piEnvVar) {
        if (cred.kind === 'oauth') {
          // Reached only if an oauth row exists under a Pi-backend id (connect
          // guards against this — oauth is anthropic/openai/github-copilot
          // only). The Pi runtime consumes subscriptions via the aggregate
          // auth.json (buildPiAuthJson), not this per-vendor env path.
          throw new Error(
            `Vendor '${vendor}' (Pi backend) has no env-based OAuth delivery; subscriptions reach Pi via auth.json.`
          );
        }
        return { env: { [piEnvVar]: cred.apiKey } };
      }
      if (PI_AMBIENT_VENDORS.includes(vendor)) {
        // Ambient-ONLY vendors (amazon-bedrock — no env var in the map):
        // chains are detected from the environment, never stored — a stored
        // row for one is a connect bug.
        throw new Error(
          `Vendor '${vendor}' uses ambient cloud credentials and has no stored-credential delivery.`
        );
      }
      throw new Error(
        `Unknown credential vendor '${vendor}'. Known: ${[...KNOWN_VENDORS].sort().join(', ')}.`
      );
    }
  }
}

/**
 * A Pi `AuthStorage` `auth.json` entry (see `@earendil-works/pi-coding-agent`
 * `core/auth-storage.d.ts`): an API key or an OAuth blob, keyed by Pi provider id.
 */
type PiAuthCredential = { type: 'api_key'; key: string } | ({ type: 'oauth' } & OAuthCredentials);

/** Relative path (under the per-run artifacts dir) for the generated Pi auth.json. */
export { PI_AUTH_JSON_RELATIVE_PATH };

View on GitHub (pinned to 0773b97458)

Solutions

  1. Delete the stored credential row for the ambient vendor; it can never be delivered.
  2. Configure the vendor in the server environment instead (AWS_PROFILE or AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY for Bedrock; GOOGLE_APPLICATION_CREDENTIALS + project/location for Vertex).
  3. Route connect calls through persistProviderApiKey, whose isConnectableVendor guard rejects ambient vendors up front.
  4. If a legit vendor is hitting this, it was likely misclassified — check its presence in PI_PROVIDER_ENV_VARS.

Example fix

// before
await saveUserProviderKey({ userId, provider: 'amazon-bedrock', key });
// after: configure env instead
process.env.AWS_PROFILE = 'my-profile'; // ambient detection handles the rest
Defensive patterns

Strategy: validation

Validate before calling

import { PI_AMBIENT_VENDORS } from '@archon/providers';
import { isConnectableVendor, normalizeCredentialVendor } from './credentials';
function shouldStoreCredential(vendor: string): boolean {
  const v = normalizeCredentialVendor(vendor);
  return isConnectableVendor(v) && !PI_AMBIENT_VENDORS.includes(v);
}

Try / catch

try {
  const r = deliverCredential(vendor, cred);
} catch (e) {
  if ((e as Error).message.includes('ambient cloud credentials')) {
    // delete the bogus row; rely on ambient env detection instead
  } else throw e;
}

Prevention

When it happens

Trigger: deliverCredential(vendor, cred) where vendor is ambient-only (amazon-bedrock) and a stored api_key/oauth row exists — from bypassing connect-time isConnectableVendor validation, hand-inserted DB rows, or a vendor reclassified as ambient while old rows remain.

Common situations: Trying to store an AWS Bedrock key as a per-user credential instead of configuring AWS chains (AWS_PROFILE / AWS_ACCESS_KEY_ID etc.) in the server environment; stale rows left after a vendor moved to ambient-only.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/39022da29236a548. Report an issue: GitHub.