{"record":{"id":"e25cbd9f25c8e6b3","repo":"BerriAI/litellm","slug":"crowdstrike-aidr-api-base-url-is-required-set-cs","errorCode":null,"errorMessage":"CrowdStrike AIDR API base URL is required. Set CS_AIDR_BASE_URL environment variable or pass it in litellm_params.","messagePattern":"CrowdStrike AIDR API base URL is required\\. Set CS_AIDR_BASE_URL environment variable or pass it in litellm_params\\.","errorType":"exception","errorClass":"CrowdStrikeAIDRGuardrailMissingSecrets","httpStatus":null,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/crowdstrike_aidr/crowdstrike_aidr.py","lineNumber":263,"sourceCode":"        Initializes the CrowdStrikeAIDRHandler.\n\n        Args:\n            guardrail_name (str): The name of the guardrail instance.\n            api_key (str | None): The CrowdStrike AIDR API key. Reads from CS_AIDR_TOKEN env var if None.\n            api_base (str | None): The CrowdStrike AIDR API base URL. Reads from CS_AIDR_BASE_URL env var if None.\n            **kwargs: Additional arguments passed to the CustomGuardrail base class.\n        \"\"\"\n        self.async_handler = get_async_httpx_client(llm_provider=httpxSpecialProvider.GuardrailCallback)\n\n        self.api_key = api_key or os.environ.get(\"CS_AIDR_TOKEN\")\n        if not self.api_key:\n            raise CrowdStrikeAIDRGuardrailMissingSecrets(\n                \"CrowdStrike AIDR API Key not found. Set CS_AIDR_TOKEN environment variable or pass it in litellm_params.\"\n            )\n\n        self.api_base = api_base or os.environ.get(\"CS_AIDR_BASE_URL\")\n        if not self.api_base:\n            raise CrowdStrikeAIDRGuardrailMissingSecrets(\n                \"CrowdStrike AIDR API base URL is required. Set CS_AIDR_BASE_URL environment variable or pass it in litellm_params.\"\n            )\n\n        kwargs.setdefault(\"supported_event_hooks\", list(self.get_supported_event_hooks()))\n        # Pass relevant kwargs to the parent class\n        super().__init__(guardrail_name=guardrail_name, **kwargs)\n        verbose_proxy_logger.debug(\n            \"Initialized CrowdStrike AIDR Guardrail: name=%s, api_base=%s\", guardrail_name, self.api_base\n        )\n\n    async def _call_crowdstrike_aidr_guard(\n        self, payload: dict[str, Any], hook_name: str\n    ) -> _GuardChatCompletionsResult:\n        \"\"\"\n        Makes the API call to the CrowdStrike AIDR AI Guard endpoint.\n        The function itself will raise an error if a response should be blocked,\n        but otherwise will return a list of redacted messages that the caller\n        should act on.","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/crowdstrike_aidr/crowdstrike_aidr.py#L245-L281","documentation":"Raised by CrowdStrikeAIDRHandler.__init__ when the CrowdStrike AIDR guardrail is instantiated without an API base URL: neither the api_base constructor argument (from litellm_params) nor the CS_AIDR_BASE_URL environment variable is set. The handler needs the guard endpoint URL up front, so the guardrail refuses to register at config-load time.","triggerScenarios":"A crowdstrike-aidr guardrails entry in config.yaml that supplies api_key (or has CS_AIDR_TOKEN set) but omits api_base while CS_AIDR_BASE_URL is unset in the proxy process.","commonSituations":"Only the token was carried over from docs/examples (the base URL is easy to miss); base URL defined per-environment in staging but not in prod manifests; typo in the variable name.","solutions":["Set CS_AIDR_BASE_URL to your CrowdStrike AIDR guard endpoint in the proxy environment and restart","Or add api_base under litellm_params in the guardrails entry: api_base: os.environ/CS_AIDR_BASE_URL","Confirm the value is a complete URL (scheme + host, per your CrowdStrike tenant) reachable from the proxy","Verify with printenv CS_AIDR_BASE_URL inside the same service context"],"exampleFix":"# before\nguardrails:\n  - guardrail_id: crowdstrike-aidr\n    litellm_params:\n      mode: guardrail_runs_before_llm_call\n      api_key: os.environ/CS_AIDR_TOKEN\n\n# after\n# export CS_AIDR_BASE_URL=https://your-tenant.crowdstrike.cloud/api/aidr\nguardrails:\n  - guardrail_id: crowdstrike-aidr\n    litellm_params:\n      mode: guardrail_runs_before_llm_call\n      api_key: os.environ/CS_AIDR_TOKEN\n      api_base: os.environ/CS_AIDR_BASE_URL","handlingStrategy":"validation","validationCode":"import os\nfrom urllib.parse import urlparse\n\nbase = os.environ.get('CS_AIDR_BASE_URL')\nif not base or not urlparse(base).scheme or not urlparse(base).netloc:\n    raise RuntimeError('CS_AIDR_BASE_URL must be set to a full URL (scheme + host)')","typeGuard":null,"tryCatchPattern":"from litellm.proxy.guardrails.guardrail_hooks.crowdstrike_aidr.crowdstrike_aidr import (\n    CrowdStrikeAIDRGuardrailMissingSecrets,\n)\ntry:\n    handler = CrowdStrikeAIDRHandler(guardrail_name='cs-aidr', api_key=os.environ['CS_AIDR_TOKEN'])\nexcept CrowdStrikeAIDRGuardrailMissingSecrets as e:\n    raise SystemExit(f'guardrail config incomplete: {e}') from e","preventionTips":["Keep the base URL in an env var per environment (staging/prod tenants differ) rather than hard-coded YAML","Validate scheme+host with urlparse in the deploy preflight, not just presence","Pair the base URL with the token in the same secret store entry so they cannot skew"],"tags":["crowdstrike","guardrails","base-url","environment-variables","litellm-proxy","startup-config"],"backgroundTag":"missing-required-config","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}