anomalyco/sst · error · VisibleError

The provided ARN "${arn}" is not an SQS Queue ARN.

Error message

The provided ARN "${arn}" is not an SQS Queue ARN.

What it means

parseQueueArn validates an SQS queue ARN (arn:aws:sqs:region:account-id:queue-name) and derives the queue URL. It throws a VisibleError when the first segment is not 'arn' or the queue-name segment is missing.

Source

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

    );
  return { bucketName };
}

export function parseTopicArn(arn: string) {
  // arn:aws:sns:region:account-id:topic-name
  const topicName = arn.split(":")[5];
  if (!arn.startsWith("arn:") || !topicName)
    throw new VisibleError(
      `The provided ARN "${arn}" is not an SNS Topic ARN.`,
    );
  return { topicName };
}

export function parseQueueArn(arn: string) {
  // arn:aws:sqs:region:account-id:queue-name
  const [arnStr, , , region, accountId, queueName] = arn.split(":");
  if (arnStr !== "arn" || !queueName)
    throw new VisibleError(
      `The provided ARN "${arn}" is not an SQS Queue ARN.`,
    );
  return {
    queueName,
    queueUrl: `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`,
  };
}

export function parseDynamoArn(arn: string) {
  // arn:aws:dynamodb:region:account-id:table/table-name
  const tableName = arn.split("/")[1];
  if (!arn.startsWith("arn:") || !tableName)
    throw new VisibleError(
      `The provided ARN "${arn}" is not a DynamoDB table ARN.`,
    );
  return { tableName };
}

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Use the full form arn:aws:sqs:region:account-id:queue-name
  2. Do not pass the queue URL; parseQueueArn generates the URL from the ARN itself
  3. Copy the ARN directly from the SQS console queue details

Example fix

// before
parseQueueArn("https://sqs.us-east-1.amazonaws.com/123456789012/my-queue");
// after
parseQueueArn("arn:aws:sqs:us-east-1:123456789012:my-queue");
Defensive patterns

Strategy: validation

Validate before calling

const QUEUE_ARN = /^arn:aws[a-zA-Z-]*:sqs:[^:]+:\d{12}:.+$/;
if (!QUEUE_ARN.test(arn)) throw new Error(`Not an SQS queue ARN: ${arn}`);

Type guard

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

Try / catch

try {
  const { queueName, queueUrl } = parseQueueArn(arn);
} catch (e) {
  throw new Error(`Failed to parse SQS queue ARN "${arn}": ${(e as Error).message}`);
}

Prevention

When it happens

Trigger: Subscribing a function to an SQS queue by ARN or creating a queue policy where the string is a queue URL, a queue name, or a malformed ARN.

Common situations: Passing the queue URL (https://sqs...) instead of the ARN, passing just the queue name, or a FIFO queue name copied without proper segments.

Related errors


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