{"record":{"id":"9293f3bc5d55ddbb","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-project-id-but-re-9293f3","errorCode":null,"errorMessage":"Expected a non-empty value for `project_id` but received {project_id!r}","messagePattern":"Expected a non-empty value for `project_id` but received (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/admin/organization/projects/spend_alerts.py","lineNumber":84,"sourceCode":"        Args:\n          currency: The currency for the threshold amount.\n\n          interval: The time interval for evaluating spend against the threshold.\n\n          notification_channel: Email notification settings for a spend alert.\n\n          threshold_amount: The alert threshold amount, in cents.\n\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        return self._post(\n            path_template(\"/organization/projects/{project_id}/spend_alerts\", project_id=project_id),\n            body=maybe_transform(\n                {\n                    \"currency\": currency,\n                    \"interval\": interval,\n                    \"notification_channel\": notification_channel,\n                    \"threshold_amount\": threshold_amount,\n                },\n                spend_alert_create_params.SpendAlertCreateParams,\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            ),","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/admin/organization/projects/spend_alerts.py#L66-L102","documentation":"Creating a project spend alert requires the project_id path parameter; the SDK raises ValueError before the POST when project_id is empty.","triggerScenarios":"Calling client.admin.organization.projects.spend_alerts.create(...) (sync) with project_id=None or ''.","commonSituations":"Missing PROJECT_ID env var, per-project loops where one project record lacks an ID, or wrong argument order/keyword when migrating code.","solutions":["Pass a real project ID such as 'proj_abc123'","Validate config/env at startup so the ID is guaranteed non-empty","Add unit tests asserting the ID is present before calling the SDK"],"exampleFix":"// before\nclient.admin.organization.projects.spend_alerts.create(project_id=\"\", currency=\"usd\", interval=\"monthly\", threshold_amount=100)\n// after\nclient.admin.organization.projects.spend_alerts.create(project_id=\"proj_abc123\", currency=\"usd\", interval=\"monthly\", threshold_amount=100)","handlingStrategy":"validation","validationCode":"if not project_id:\n    raise ValueError(\"project_id is required to create a spend alert\")\nclient.admin.organization.projects.spend_alerts.create(\n    project_id=project_id, currency=\"usd\", interval=\"monthly\", threshold_amount=100\n)","typeGuard":"def is_valid_project_id(project_id: object) -> bool:\n    return isinstance(project_id, str) and bool(project_id.strip()) and project_id.startswith(\"proj_\")","tryCatchPattern":null,"preventionTips":["Validate project config before creating resources","Write a small unit test that asserts required IDs are non-empty"],"tags":["openai","admin-api","validation","valueerror","project-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"}