{"record":{"id":"d6a1586e24099137","repo":"abhigyanpatwari/GitNexus","slug":"azure-content-filter-blocked-this-request-the-pro","errorCode":null,"errorMessage":"Azure content filter blocked this request. The prompt triggered content policy. Details: ${errorText.slice(0, 300)}","messagePattern":"Azure content filter blocked this request\\. The prompt triggered content policy\\. Details: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/wiki/llm-client.ts","lineNumber":441,"sourceCode":"    if (config.requestTimeoutMs !== undefined && isTimeoutLikeError(err)) {\n      throw new Error(\n        `LLM request timed out after ${formatTimeoutDuration(config.requestTimeoutMs)}. ` +\n          'Increase --timeout or omit it to disable the request timeout.',\n      );\n    }\n    throw err;\n  }\n\n  if (!response.ok) {\n    const errorText = await response.text().catch(() => 'unknown error');\n\n    // Azure content filter — surface a clear message instead of a generic API error.\n    if (\n      azure &&\n      response.status === 400 &&\n      (errorText.includes('content_filter') || errorText.includes('ResponsibleAIPolicyViolation'))\n    ) {\n      throw new Error(\n        `Azure content filter blocked this request. The prompt triggered content policy. Details: ${errorText.slice(0, 300)}`,\n      );\n    }\n\n    // Any other non-OK response here is a terminal 4xx — resilientFetch\n    // already retried 5xx/429 to exhaustion and would have thrown above.\n    throw new Error(`LLM API error (${response.status}): ${errorText.slice(0, 500)}`);\n  }\n\n  // Streaming path\n  if (useStream && response.body) {\n    return await readSSEStream(response.body, options!.onChunk!);\n  }\n\n  // Non-streaming path\n  const json = (await response.json()) as any;\n  const choice = json.choices?.[0];\n  if (!choice?.message?.content) {","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/core/wiki/llm-client.ts#L423-L459","documentation":"The response was HTTP 400 from a detected Azure OpenAI endpoint and the body contains 'content_filter' or 'ResponsibleAIPolicyViolation'. Azure rejected the prompt (or completion) under its content policy before returning content, and the client maps this to a clearer message than the generic API error, including up to 300 chars of Azure's filter details.","triggerScenarios":"Using `--provider azure` and sending a code snippet or documentation text that trips Azure's content filters; wiki page content for a security-related repo (exploit code, security tooling) is a frequent trigger; filter severity thresholds set strict in the Azure deployment.","commonSituations":"Generating wikis for security tools, malware-analysis repos, or medical/violent-named symbols; strict Azure content-filter configurations on corporate tenants; prompts large enough that innocuous text accumulates a high risk score.","solutions":["Request content-filter adjustments on the Azure OpenAI resource (or a dedicated deployment with relaxed filters) via Azure portal / Azure AI Foundry","Exclude or rename the offending module from wiki generation so the prompt no longer contains filtered content","Switch provider/model (`--provider openai`, etc.) if policy allows","Inspect the 'Details:' portion to identify which filter category fired and adjust the repo content or prompt"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await callLLM(prompt, config);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Azure content filter blocked')) {\n    // log the page/module, skip it, and continue wiki generation for remaining modules\n    return { content: fallbackStubPage(module) };\n  }\n  throw err;\n}","preventionTips":["Test representative repo prompts against the Azure deployment's filter settings before adopting it for wikis","Keep security-sensitive repos on providers with lighter filtering","Track which modules trip filters and exclude them from LLM generation"],"tags":["llm","azure","content-filter","moderation","gitnexus"],"backgroundTag":"content-filter-blocked","analyzedSha":"52924ef12c2290ceee4612526a828ec4cdf2047f","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}