anomalyco/sst · error · VisibleError
Priority ${rule.priority} must be between 1 and 50000 in Ser
Error message
Priority ${rule.priority} must be between 1 and 50000 in Service "${name}". When sharing an ALB, ensure non-overlapping priority ranges across services. What it means
ALB listener rules support priorities from 1 to 50000. When services share an external ALB, SST also requires that priorities don't overlap across services, so out-of-range values are rejected up front with a reminder about cross-service priority ranges.
Source
Thrown at platform/src/components/aws/service.ts:2726
targetGroup: e.targetGroup,
containerName: e.explicitContainer ?? ctrs[0].name,
containerPort: e.containerPort,
})),
);
return { targets, entries };
}
function createAlbListenerRules(
attachment: NonNullable<typeof albAttachment>,
albTargets: Record<string, lb.TargetGroup>,
) {
const rules = attachment.rules;
const prioritiesByListener = new Map<string, Set<number>>();
for (const rule of rules) {
if (rule.priority < 1 || rule.priority > 50000) {
throw new VisibleError(
`Priority ${rule.priority} must be between 1 and 50000 in Service "${name}". When sharing an ALB, ensure non-overlapping priority ranges across services.`,
);
}
const seen =
prioritiesByListener.get(rule.listen) ?? new Set();
if (seen.has(rule.priority)) {
throw new VisibleError(
`Duplicate priority ${rule.priority} on listener "${rule.listen}" in Service "${name}".`,
);
}
seen.add(rule.priority);
prioritiesByListener.set(rule.listen, seen);
if (
!rule.conditions?.path &&
!rule.conditions?.query &&
!rule.conditions?.headerView on GitHub (pinned to a0bd20f762)
Solutions
- Set priority to an integer between 1 and 50000
- When sharing an ALB, partition disjoint priority ranges per service (e.g. service A: 1-1000, service B: 1001-2000)
- Remove explicit priority and let defaults apply if order doesn't matter
Example fix
// before
rules: [{ priority: 0, ... }]
// after
rules: [{ priority: 1, ... }] Defensive patterns
Strategy: validation
Validate before calling
for (const r of attachment.rules)
if (!Number.isInteger(r.priority) || r.priority < 1 || r.priority > 50000)
throw new Error(`priority ${r.priority} out of range 1-50000`); Type guard
const isValidPriority = (p: number): p is number => Number.isInteger(p) && p >= 1 && p <= 50000;
Try / catch
null
Prevention
- Reserve disjoint priority ranges per service when sharing an ALB
- Never use 0 or sentinel values like 999999
- Centralize priority allocation in one config module
When it happens
Trigger: Defining a rule with priority: 0, a negative number, or anything above 50000 in an ALB attachment for Service "name".
Common situations: Using 0-based indexes from code into ALB's 1-based priorities; computing priorities dynamically from array positions; assuming large sentinel values (e.g. 999999 for 'last') are allowed.
Related errors
- Duplicate priority ${rule.priority} on listener "${rule.list
- You must provide at least one rule in "loadBalancer.rules" w
- At least one condition (path, query, or header) must be set
- Protocols must be either all http/https, or all tcp/udp/tcp_
- The listen protocol "${v.listen}" must match the forward pro
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/d3904bf5990630d2.
Report an issue: GitHub.