anomalyco/sst · error · VisibleError

The provided ARN "${arn}" is not a EventBridge event bus ARN

Error message

The provided ARN "${arn}" is not a EventBridge event bus ARN.

What it means

parseEventBusArn validates an EventBridge event bus ARN (arn:aws:events:region:account-id:event-bus/bus-name) and extracts the bus name. It throws a VisibleError when the string lacks 'arn:' or has no '/'-delimited bus name.

Source

Thrown at platform/src/components/aws/helpers/arn.ts:97

  return { tableName };
}

export function parseKinesisStreamArn(streamArn: string) {
  // ie. "arn:aws:kinesis:us-east-1:123456789012:stream/MyStream";
  const parts = streamArn.split(":");
  const streamName = parts[5]?.split("/")[1];
  if (parts[0] !== "arn" || parts[2] !== "kinesis" || !streamName)
    throw new VisibleError(
      `The provided ARN "${streamArn}" is not a Kinesis stream ARN.`,
    );
  return { streamName };
}

export function parseEventBusArn(arn: string) {
  // arn:aws:events:region:account-id:event-bus/bus-name
  const busName = arn.split("/")[1];
  if (!arn.startsWith("arn:") || !busName)
    throw new VisibleError(
      `The provided ARN "${arn}" is not a EventBridge event bus ARN.`,
    );
  return { busName };
}

export function parseRoleArn(arn: string) {
  // arn:aws:iam::123456789012:role/MyRole
  const roleName = arn.split("/")[1];
  if (!arn.startsWith("arn:") || !roleName)
    throw new VisibleError(`The provided ARN "${arn}" is not an IAM role ARN.`);
  return { roleName };
}

export function parseLambdaEdgeArn(arn: string) {
  // First validate it's a Lambda function ARN
  const { functionName } = parseFunctionArn(arn);

  // arn:aws:lambda:region:account-id:function:function-name:version

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Use the full form arn:aws:events:region:account-id:event-bus/bus-name
  2. If you only have the bus name, construct the ARN with region and account ID
  3. For the default bus use `arn:aws:events:${region}:${account}:event-bus/default`

Example fix

// before
parseEventBusArn("my-bus");
// after
parseEventBusArn("arn:aws:events:us-east-1:123456789012:event-bus/my-bus");
Defensive patterns

Strategy: validation

Validate before calling

const BUS_ARN = /^arn:aws[a-zA-Z-]*:events:[^:]+:\d{12}:event-bus\/[^/]+$/;
if (!BUS_ARN.test(arn)) throw new Error(`Not an EventBridge bus ARN: ${arn}`);

Type guard

function isEventBusArn(v: string): boolean {
  return /^arn:aws[a-zA-Z-]*:events:[^:]+:\d{12}:event-bus\/[^/]+$/.test(v);
}

Try / catch

try {
  const { busName } = parseEventBusArn(arn);
} catch (e) {
  throw new Error(`Failed to parse event bus ARN "${arn}": ${(e as Error).message}`);
}

Prevention

When it happens

Trigger: Using EventBus.fromEventBusArn (or passing an ARN where a bus is expected) with a bus name, a rule ARN, or a malformed string.

Common situations: Passing just the bus name, copying a rule or archive ARN instead of the bus ARN, referencing the default bus with a nonstandard string.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/2a775f906853d883. Report an issue: GitHub.