{"record":{"id":"017265081017c6ac","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-project-id-but-re-017265","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/projects.py","lineNumber":282,"sourceCode":"        extra_headers: Headers | None = None,\n        extra_query: Query | None = None,\n        extra_body: Body | None = None,\n        timeout: float | httpx2.Timeout | None | NotGiven = not_given,\n    ) -> Project:\n        \"\"\"\n        Retrieves a project.\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        return self._get(\n            path_template(\"/organization/projects/{project_id}\", project_id=project_id),\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=Project,\n        )\n\n    def update(\n        self,\n        project_id: str,\n        *,\n        external_key_id: Optional[str] | Omit = omit,\n        geography: Optional[str] | Omit = omit,","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/admin/organization/projects/projects.py#L264-L300","documentation":"The sync `retrieve` on the admin projects resource requires a non-empty `project_id` for GET `/organization/projects/{project_id}`. The SDK raises this ValueError before the request when the value is None or empty, since there is no meaningful URL to fetch.","triggerScenarios":"Calling `client.admin.organization.projects.retrieve(project_id='')` or passing an unset variable when fetching project details (name, users, rate limits).","commonSituations":"The project id env var (e.g. OPENAI_PROJECT_ID style config) is not set in the current shell/CI, or a UI/backend passes an empty string when no project is selected.","solutions":["Ensure the project id is provided and looks like 'proj_...'","Check env var name and export status in CI","Validate ids at process start and fail fast","Fetch ids via projects.list() instead of hardcoding"],"exampleFix":"# before\nproject = client.admin.organization.projects.retrieve(project_id)\n\n# after\nif not project_id:\n    raise SystemExit(\"project_id is required\")\nproject = client.admin.organization.projects.retrieve(project_id)","handlingStrategy":"validation","validationCode":"project_id = (os.environ.get(\"OPENAI_PROJECT_ID\") or \"\").strip()\nif not project_id:\n    raise SystemExit(\"OPENAI_PROJECT_ID is not set\")","typeGuard":"def valid_project_id(v: object) -> TypeGuard[str]:\n    return isinstance(v, str) and v.startswith(\"proj_\")","tryCatchPattern":"try:\n    project = client.admin.organization.projects.retrieve(project_id)\nexcept ValueError as e:\n    if \"project_id\" in str(e):\n        raise ConfigError(str(e))\n    raise","preventionTips":["Validate env vars at process start","Fetch project ids from projects.list() instead of typing them","Reject empty selection in UIs before calling the SDK"],"tags":["openai","python","admin-api","parameter-validation","projects"],"backgroundTag":"empty-path-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}