{"record":{"id":"02803ede91608750","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-project-id-but-re-02803e","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/model_permissions.py","lineNumber":67,"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    ) -> ProjectModelPermissions:\n        \"\"\"\n        Returns model permissions for 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}/model_permissions\", 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=ProjectModelPermissions,\n        )\n\n    def update(\n        self,\n        project_id: str,\n        *,\n        mode: Literal[\"allow_list\", \"deny_list\"],\n        model_ids: SequenceNotStr[str],","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/admin/organization/projects/model_permissions.py#L49-L85","documentation":"The sync `retrieve` of the admin model permissions resource requires a non-empty `project_id` for the GET to `/organization/projects/{project_id}/model_permissions`. The SDK raises this ValueError before the request when the value is falsy.","triggerScenarios":"Calling `model_permissions.retrieve(project_id='')` while trying to read which models a project can access, with an id variable that was never populated.","commonSituations":"Scripts parameterized by project where the argument was not passed, or reading the id from a YAML/JSON config with a typo'd key.","solutions":["Print or log project_id before the call","Check the config key or CLI argument that supplies it","Load the id from projects.list()/create() responses instead of manual entry","Fail fast at startup if required ids are absent"],"exampleFix":"# before\nperms = client.admin.organization.projects.model_permissions.retrieve(project_id)\n\n# after\nassert project_id, \"project_id must be set\"\nperms = client.admin.organization.projects.model_permissions.retrieve(project_id)","handlingStrategy":"validation","validationCode":"if not project_id:\n    raise ValueError(\"project_id required to read model permissions\")","typeGuard":"def valid_project_id(v: object) -> TypeGuard[str]:\n    return isinstance(v, str) and v.strip() != \"\"","tryCatchPattern":"try:\n    perms = ...model_permissions.retrieve(project_id)\nexcept ValueError as e:\n    if \"project_id\" in str(e):\n        raise ConfigError(str(e))\n    raise","preventionTips":["Validate config keys that hold project ids","Log ids before API calls during onboarding scripts","Pull ids from projects.list()"],"tags":["openai","python","admin-api","parameter-validation","model-permissions"],"backgroundTag":"empty-path-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}