{"record":{"id":"caf0e61b95afd6e4","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-alert-id-but-rece","errorCode":null,"errorMessage":"Expected a non-empty value for `alert_id` but received {alert_id!r}","messagePattern":"Expected a non-empty value for `alert_id` but received (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/admin/organization/projects/spend_alerts.py","lineNumber":133,"sourceCode":"        extra_body: Body | None = None,\n        timeout: float | httpx2.Timeout | None | NotGiven = not_given,\n    ) -> ProjectSpendAlert:\n        \"\"\"\n        Retrieves a project spend alert.\n\n        Args:\n          extra_headers: Send extra headers\n\n          extra_query: Add additional query parameters to the request\n\n          extra_body: Add additional JSON properties to the request\n\n          timeout: Override the client-level default timeout for this request, in seconds\n        \"\"\"\n        if not project_id:\n            raise ValueError(f\"Expected a non-empty value for `project_id` but received {project_id!r}\")\n        if not alert_id:\n            raise ValueError(f\"Expected a non-empty value for `alert_id` but received {alert_id!r}\")\n        return self._get(\n            path_template(\n                \"/organization/projects/{project_id}/spend_alerts/{alert_id}\", project_id=project_id, alert_id=alert_id\n            ),\n            options=make_request_options(\n                extra_headers=extra_headers,\n                extra_query=extra_query,\n                extra_body=extra_body,\n                timeout=timeout,\n                security={\"admin_api_key_auth\": True},\n            ),\n            cast_to=ProjectSpendAlert,\n        )\n\n    def update(\n        self,\n        alert_id: str,\n        *,","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/admin/organization/projects/spend_alerts.py#L115-L151","documentation":"The SDK requires alert_id to be non-empty when retrieving a spend alert; an empty value fails fast with ValueError rather than requesting a malformed URL.","triggerScenarios":"Calling spend_alerts.retrieve(...) with alert_id=None or '' (project_id may be valid).","commonSituations":"Parsing alert IDs from event payloads where the field is absent, or using a variable shadowed/overwritten earlier in the function.","solutions":["Pass the real alert ID, e.g. 'alert_abc123' (from create or list responses)","Validate parsed event payloads contain alert_id before dispatching to retrieve","Log the raw payload when the ID is missing to find the mapping bug"],"exampleFix":"// before\nalert = client.admin.organization.projects.spend_alerts.retrieve(project_id=pid, alert_id=\"\")\n// after\nalert = client.admin.organization.projects.spend_alerts.retrieve(project_id=pid, alert_id=\"alert_abc123\")","handlingStrategy":"validation","validationCode":"if not alert_id:\n    raise ValueError(\"alert_id is required to retrieve a spend alert\")","typeGuard":"def is_valid_alert_id(value: object) -> bool:\n    return isinstance(value, str) and bool(value.strip())","tryCatchPattern":null,"preventionTips":["Use explicit dict access (event['alert_id']) instead of .get() where the field is required","Log raw payloads when validation fails to catch schema drift"],"tags":["openai","admin-api","validation","valueerror","alert-id","spend-alerts"],"backgroundTag":"missing-required-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}