diegosouzapw/OmniRoute · error

[RouterStrategy] Strategy

Error message

[RouterStrategy] Strategy '${name}' not found, falling back to 'rules'

What it means

Registry-miss fallback in getStrategy: a routing strategy name (from config, combo spec, or API input) is not present in strategyRegistry (known names: rules, cost/eco, latency/fast, sla-aware/sla, lkgp, etc.), so the default RulesStrategy is returned with a warning. The request still routes — just under the rules strategy instead of the requested one.

Solutions

  1. Correct the strategy name in the combo/config to a registered key (check aliases: eco=cost, fast=latency, sla=sla-aware).
  2. Register the custom strategy via registerStrategy before getStrategy is called.
  3. Validate strategy names at config-load time with Zod instead of at lookup time.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at open-sse/services/autoCombo/routerStrategy.ts:354 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/7ecff42ee39a2fec. Report an issue: GitHub.

Appendix: source

Thrown at open-sse/services/autoCombo/routerStrategy.ts:354

const rulesStrategy = new RulesStrategyImpl();
const costStrategy = new CostStrategyImpl();
const latencyStrategy = new LatencyStrategyImpl();
const slaStrategy = new SLAStrategyImpl();
const lkgpStrategy = new LKGPStrategyImpl();

strategyRegistry.set("rules", rulesStrategy);
strategyRegistry.set("cost", costStrategy);
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[],

View on GitHub (pinned to a179ffed5b)