{"record":{"id":"4d0b1fcd95c7e1d1","repo":"diegosouzapw/OmniRoute","slug":"qwen-code-requires-a-base-url-and-model","errorCode":null,"errorMessage":"Qwen Code requires a base URL and model","messagePattern":"Qwen Code requires a base URL and model","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/shared/services/qwenCodeConfig.ts","lineNumber":88,"sourceCode":"const removeEmptyObject = (parent: JsonRecord, key: string): void => {\n  if (isRecord(parent[key]) && Object.keys(parent[key]).length === 0) delete parent[key];\n};\n\nexport type QwenCodeConfigInput = {\n  baseUrl: string;\n  model: string;\n  modelName?: string;\n};\n\nexport const buildQwenCodeModel = ({\n  baseUrl,\n  model,\n  modelName,\n}: QwenCodeConfigInput): JsonRecord => {\n  const normalizedBaseUrl = normalizeQwenCodeBaseUrl(baseUrl);\n  const normalizedModel = String(model || \"\").trim();\n  if (!normalizedBaseUrl || !normalizedModel) {\n    throw new Error(\"Qwen Code requires a base URL and model\");\n  }\n\n  return {\n    id: normalizedModel,\n    name: `${String(modelName || normalizedModel).trim()} (OmniRoute)`,\n    envKey: QWEN_CODE_ENV_KEY,\n    baseUrl: normalizedBaseUrl,\n  };\n};\n\n/**\n * Merge one OmniRoute model into Qwen Code's current V4 settings contract.\n * `modelProviders.openai` is a bare ModelConfig[] array. Other settings and\n * user-owned provider entries are preserved.\n */\nexport const mergeQwenCodeSettings = (\n  existing: unknown,\n  input: QwenCodeConfigInput","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/shared/services/qwenCodeConfig.ts#L70-L106","documentation":"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.","triggerScenarios":"Thrown at src/shared/services/qwenCodeConfig.ts:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}