diegosouzapw/OmniRoute · error
[RouterStrategy] Overwriting strategy
Error message
[RouterStrategy] Overwriting strategy '${name}' What it means
Warning in registerStrategy: a strategy is being registered under a name that already exists in strategyRegistry, so the new implementation silently replaces the previous one (built-ins or an earlier custom registration). This is intended for intentional overrides but usually indicates a duplicate registration, a plugin loaded twice, or a name collision with a built-in alias.
Solutions
- Check for double plugin/module initialization registering the same strategy name twice.
- Choose a unique name for custom strategies instead of shadowing built-ins (rules/cost/latency/sla/lkgp and aliases).
- If the overwrite is intentional, acknowledge the warning or add an explicit allowOverride flag.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at open-sse/services/autoCombo/routerStrategy.ts:362 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/25bc938ff1851fda.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/services/autoCombo/routerStrategy.ts:362
strategyRegistry.set("eco", costStrategy); // alias
strategyRegistry.set("latency", latencyStrategy);
strategyRegistry.set("fast", latencyStrategy); // alias
strategyRegistry.set("sla-aware", slaStrategy);
strategyRegistry.set("sla", slaStrategy); // alias
strategyRegistry.set("lkgp", lkgpStrategy);
export function getStrategy(name: string): RouterStrategy {
const strategy = strategyRegistry.get(name);
if (!strategy) {
console.warn(`[RouterStrategy] Strategy '${name}' not found, falling back to 'rules'`);
return rulesStrategy;
}
return strategy;
}
export function registerStrategy(name: string, strategy: RouterStrategy): void {
if (strategyRegistry.has(name)) {
console.warn(`[RouterStrategy] Overwriting strategy '${name}'`);
}
strategyRegistry.set(name, strategy);
}
export function listStrategies(): Array<{ name: string; description: string }> {
return [...strategyRegistry.entries()].map(([name, s]) => ({ name, description: s.description }));
}
export function selectWithStrategy(
pool: ProviderCandidate[],
context: RoutingContext,
strategyName = "rules"
): RoutingDecision {
return getStrategy(strategyName).select(pool, context);
}
View on GitHub (pinned to a179ffed5b)