{"record":{"id":"a7168271c18a546e","repo":"earendil-works/pi","slug":"invalid-azure-openai-base-url-baseurl","errorCode":null,"errorMessage":"Invalid Azure OpenAI base URL: ${baseUrl}","messagePattern":"Invalid Azure OpenAI base URL: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ai/src/api/azure-openai-responses.ts","lineNumber":192,"sourceCode":"\t\t...buildBaseOptions(model, context, options, apiKey),\n\t\ttoolChoice: options?.toolChoice,\n\t} satisfies AzureOpenAIResponsesOptions;\n\tconst clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : undefined;\n\tconst reasoningEffort = clampedReasoning === \"off\" ? undefined : clampedReasoning;\n\n\treturn stream(model, context, {\n\t\t...base,\n\t\treasoningEffort,\n\t} satisfies AzureOpenAIResponsesOptions);\n};\n\nfunction normalizeAzureBaseUrl(baseUrl: string): string {\n\tconst trimmed = baseUrl.trim().replace(/\\/+$/, \"\");\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(trimmed);\n\t} catch {\n\t\tthrow new Error(`Invalid Azure OpenAI base URL: ${baseUrl}`);\n\t}\n\n\tconst isAzureHost =\n\t\turl.hostname.endsWith(\".openai.azure.com\") ||\n\t\turl.hostname.endsWith(\".cognitiveservices.azure.com\") ||\n\t\turl.hostname.endsWith(\".ai.azure.com\");\n\tconst normalizedPath = url.pathname.replace(/\\/+$/, \"\");\n\n\t// Ensure Azure hosts have /openai/v1 as base path so the AzureOpenAI SDK\n\t// can append /deployments/<model>/... and ?api-version=v1 correctly.\n\tif (\n\t\tisAzureHost &&\n\t\t(normalizedPath === \"\" ||\n\t\t\tnormalizedPath === \"/\" ||\n\t\t\tnormalizedPath === \"/openai\" ||\n\t\t\tnormalizedPath === \"/openai/v1/responses\")\n\t) {\n\t\turl.pathname = \"/openai/v1\";","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/ai/src/api/azure-openai-responses.ts#L174-L210","documentation":"Error \"Invalid Azure OpenAI base URL: ${baseUrl}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/ai/src/api/azure-openai-responses.ts:192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a valid https:// endpoint URL for the Azure OpenAI base URL."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}