diegosouzapw/OmniRoute · error · Error
Qwen Code requires a base URL and model
Error message
Qwen Code requires a base URL and model
What it means
Input validation error in buildQwenCodeModel(): after normalization either the base URL or the model string is empty/missing, and a Qwen Code provider entry cannot be constructed without both. It fires when callers pass blank or whitespace-only config inputs.
Solutions
- Supply both baseUrl (OmniRoute endpoint) and model name in the Qwen Code config input
- Trim the values — whitespace-only strings are rejected
- Ensure the calling UI/form marks both fields required before submit
- Add a Zod schema at the API boundary to catch this before reaching the builder
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/shared/services/qwenCodeConfig.ts:88 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/4d0b1fcd95c7e1d1.
Report an issue: GitHub.
Appendix: source
Thrown at src/shared/services/qwenCodeConfig.ts:88
const removeEmptyObject = (parent: JsonRecord, key: string): void => {
if (isRecord(parent[key]) && Object.keys(parent[key]).length === 0) delete parent[key];
};
export type QwenCodeConfigInput = {
baseUrl: string;
model: string;
modelName?: string;
};
export const buildQwenCodeModel = ({
baseUrl,
model,
modelName,
}: QwenCodeConfigInput): JsonRecord => {
const normalizedBaseUrl = normalizeQwenCodeBaseUrl(baseUrl);
const normalizedModel = String(model || "").trim();
if (!normalizedBaseUrl || !normalizedModel) {
throw new Error("Qwen Code requires a base URL and model");
}
return {
id: normalizedModel,
name: `${String(modelName || normalizedModel).trim()} (OmniRoute)`,
envKey: QWEN_CODE_ENV_KEY,
baseUrl: normalizedBaseUrl,
};
};
/**
* Merge one OmniRoute model into Qwen Code's current V4 settings contract.
* `modelProviders.openai` is a bare ModelConfig[] array. Other settings and
* user-owned provider entries are preserved.
*/
export const mergeQwenCodeSettings = (
existing: unknown,
input: QwenCodeConfigInputView on GitHub (pinned to a179ffed5b)