abhigyanpatwari/GitNexus · error · Error

Azure content filter blocked this request. The prompt…

Error message

Azure content filter blocked this request. The prompt triggered content policy. Details: ${errorText.slice(0, 300)}

What it means

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.

Solutions

  1. Request content-filter adjustments on the Azure OpenAI resource (or a dedicated deployment with relaxed filters) via Azure portal / Azure AI Foundry
  2. Exclude or rename the offending module from wiki generation so the prompt no longer contains filtered content
  3. Switch provider/model (`--provider openai`, etc.) if policy allows
  4. Inspect the 'Details:' portion to identify which filter category fired and adjust the repo content or prompt
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await callLLM(prompt, config);
} catch (err) {
  if (err instanceof Error && err.message.startsWith('Azure content filter blocked')) {
    // log the page/module, skip it, and continue wiki generation for remaining modules
    return { content: fallbackStubPage(module) };
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20). Data as JSON: /api/errors/d6a1586e24099137. Report an issue: GitHub.

Appendix: source

Thrown at gitnexus/src/core/wiki/llm-client.ts:441

    if (config.requestTimeoutMs !== undefined && isTimeoutLikeError(err)) {
      throw new Error(
        `LLM request timed out after ${formatTimeoutDuration(config.requestTimeoutMs)}. ` +
          'Increase --timeout or omit it to disable the request timeout.',
      );
    }
    throw err;
  }

  if (!response.ok) {
    const errorText = await response.text().catch(() => 'unknown error');

    // Azure content filter — surface a clear message instead of a generic API error.
    if (
      azure &&
      response.status === 400 &&
      (errorText.includes('content_filter') || errorText.includes('ResponsibleAIPolicyViolation'))
    ) {
      throw new Error(
        `Azure content filter blocked this request. The prompt triggered content policy. Details: ${errorText.slice(0, 300)}`,
      );
    }

    // Any other non-OK response here is a terminal 4xx — resilientFetch
    // already retried 5xx/429 to exhaustion and would have thrown above.
    throw new Error(`LLM API error (${response.status}): ${errorText.slice(0, 500)}`);
  }

  // Streaming path
  if (useStream && response.body) {
    return await readSSEStream(response.body, options!.onChunk!);
  }

  // Non-streaming path
  const json = (await response.json()) as any;
  const choice = json.choices?.[0];
  if (!choice?.message?.content) {

View on GitHub (pinned to 52924ef12c)