musistudio/claude-code-router · warning
OpenRouter discount routing skipped: ${formatError(error)}
Error message
OpenRouter discount routing skipped: ${formatError(error)} What it means
Logged by the OpenRouter discount provider router plugin transform when routeOpenRouterRequestByEndpointDiscount throws while inspecting/rerouting a request. The transform deliberately degrades gracefully: it warns and returns undefined so the request proceeds unchanged through the gateway without discount routing.
Source
Thrown at packages/core/src/plugins/built-ins/openrouter-discount-provider-router.ts:102
const pendingSelections = new Map<string, PendingSelection>();
export const openRouterDiscountProviderRouterTransform: GatewayPluginRequestTransformHandler = async (
input,
context
) => {
const body = cloneRecord(input.body);
if (!body) {
return undefined;
}
const target = resolveOpenRouterDiscountRoutingTarget(input, context.config);
if (!target) {
return undefined;
}
try {
return await routeOpenRouterRequestByEndpointDiscount(input, body, target);
} catch (error) {
context.logger.warn(`OpenRouter discount routing skipped: ${formatError(error)}`);
return undefined;
}
};
async function routeOpenRouterRequestByEndpointDiscount(
input: GatewayPluginRequestTransformInput,
body: Record<string, unknown>,
target: OpenRouterDiscountRoutingTarget
): Promise<GatewayPluginRequestTransformResult | undefined> {
const existingProvider = isRecord(body.provider) ? body.provider : {};
const existingOrder = readStringArray(existingProvider.order);
const providerIgnore = mergeStringLists(readStringArray(existingProvider.ignore), target.settings.providerBlacklist);
if (target.settings.respectExistingProviderOrder && existingOrder.length > 0) {
return undefined;
}
const endpoints = await loadModelEndpoints(target.provider, target.model, target.settings);
const promptTokens = Math.max(positiveNumber(input.tokenCount) ?? 0, estimatePromptTokens(body));View on GitHub (pinned to 99f24806c6)
Solutions
- Inspect the formatted error; if it is a body-parse failure, restrict the router plugin to JSON chat-completion endpoints or disable it for other routes.
- Update the plugin's endpoint discount configuration to match current OpenRouter catalog paths.
- Upgrade the core package for fixes to the router's parsing logic.
- As a stopgap, disable the openrouter-discount-provider-router plugin — requests route normally at list price.
Example fix
// plugin config: disable discount routing if it keeps failing
// before
{"plugins":["openrouter-discount-provider-router"]}
// after
{"plugins":[]} Defensive patterns
Strategy: fallback
Validate before calling
null
Type guard
null
Try / catch
null
Prevention
- Keep OpenRouter endpoint discount config in sync with the current catalog
- Send well-formed JSON bodies to OpenRouter routes
- Disable the router plugin when it repeatedly skips
When it happens
Trigger: An OpenRouter-bound request whose body cannot be parsed as expected (non-JSON body, unexpected model string), missing/invalid OpenRouter pricing metadata configured for the plugin, or a bug in the discount lookup for the specific endpoint being called.
Common situations: Client sends a streaming or non-JSON payload the router tries to read; OpenRouter changes endpoint path shapes; the plugin's discount config references endpoints that no longer exist.
Related errors
- ${productName} is only available in CCR Desktop.
- ${productName} runtime module was not found. Rebuild app ass
- OpenRouter endpoints request is cooling down after failure (
- OpenRouter model id must be author/slug: ${model}
- OpenRouter endpoints request timed out after ${endpointFetch
AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27).
Data as JSON: /api/errors/6aa8914993189d95.
Report an issue: GitHub.