BerriAI/litellm · error · GuardrailRaisedException

Singulr API returned an invalid response: {exc}

Error message

Singulr API returned an invalid response: {exc}

What it means

Error "Singulr API returned an invalid response: {exc}" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/guardrails/guardrail_hooks/singulr/singulr.py:182

                raise GuardrailRaisedException(
                    guardrail_name=self.guardrail_name,
                    message=(f"Singulr API returned HTTP {exc.response.status_code}: {exc.response.text}"),
                ) from exc
            return None

        except httpx.TransportError as exc:
            verbose_proxy_logger.error("Singulr API unreachable: %s", str(exc))
            if self.block_on_error:
                raise GuardrailRaisedException(
                    guardrail_name=self.guardrail_name,
                    message=f"Singulr API unreachable (block_on_error=True): {exc}",
                ) from exc
            return None

        except (ValueError, pydantic.ValidationError) as exc:
            verbose_proxy_logger.error("Singulr API returned an invalid response: %s", str(exc))
            if self.block_on_error:
                raise GuardrailRaisedException(
                    guardrail_name=self.guardrail_name,
                    message=f"Singulr API returned an invalid response: {exc}",
                ) from exc
            return None

    @log_guardrail_information
    async def apply_guardrail(
        self,
        inputs: GenericGuardrailAPIInputs,
        request_data: dict,
        input_type: str,
        logging_obj: "LiteLLMLoggingObj | None" = None,
    ) -> GenericGuardrailAPIInputs:
        payload: Final = self._build_payload(request_data, inputs, input_type)
        if not payload:
            return inputs

        result: Final = await self._call_api(payload)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the raw Singulr API response; the endpoint may have returned non-JSON or an unexpected schema.
  2. Confirm api_base points to the correct Singulr API version.

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/singulr/singulr.py:182 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/5361d522ed88dc60. Report an issue: GitHub.