{"record":{"id":"a68c9e05bf7acbe8","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-conversation-id-b-a68c9e","errorCode":null,"errorMessage":"Expected a non-empty value for `conversation_id` but received {conversation_id!r}","messagePattern":"Expected a non-empty value for `conversation_id` but received (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/conversations/items.py","lineNumber":82,"sourceCode":"        Create items in a conversation with the given ID.\n\n        Args:\n          items: The items to add to the conversation. You may add up to 20 items at a time.\n\n          include: Additional fields to include in the response. See the `include` parameter for\n              [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)\n              for more information.\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 conversation_id:\n            raise ValueError(f\"Expected a non-empty value for `conversation_id` but received {conversation_id!r}\")\n        return self._post(\n            path_template(\"/conversations/{conversation_id}/items\", conversation_id=conversation_id),\n            body=maybe_transform({\"items\": items}, item_create_params.ItemCreateParams),\n            options=make_request_options(\n                extra_headers=extra_headers,\n                extra_query=extra_query,\n                extra_body=extra_body,\n                timeout=timeout,\n                query=maybe_transform({\"include\": include}, item_create_params.ItemCreateParams),\n                security={\"bearer_auth\": True},\n            ),\n            cast_to=ConversationItemList,\n        )\n\n    def retrieve(\n        self,\n        item_id: str,\n        *,","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/conversations/items.py#L64-L100","documentation":"Conversation items create() posts to /conversations/{conversation_id}/items and validates conversation_id is non-empty before sending. The ValueError fires synchronously in the sync client when the argument is falsy, so no HTTP request is wasted. This is a required path parameter with no default.","triggerScenarios":"Calling client.conversations.items.create(conversation_id='', items=[...]) or passing an unbound/None variable as the conversation id in the synchronous client.","commonSituations":"Building items for a conversation whose creation response wasn't captured, threading ids through multiple functions where one branch leaves it None, or typos in keyword argument names leaving the real parameter unset.","solutions":["Capture the id from conversations.create() and pass that value","Check the parameter is a non-empty string before calling items.create","Use keyword arguments to avoid positional mix-ups"],"exampleFix":"# before\nclient.conversations.items.create(conversation_id=conv, items=items)  # conv is None\n\n# after\nconv = client.conversations.create().id\nclient.conversations.items.create(conversation_id=conv, items=items)","handlingStrategy":"validation","validationCode":"if not conversation_id:\n    raise ValueError(\"cannot add items without a conversation_id\")\nclient.conversations.items.create(conversation_id=conversation_id, items=items)","typeGuard":"def is_non_empty_str(v: object) -> bool:\n    return isinstance(v, str) and len(v) > 0","tryCatchPattern":"try:\n    client.conversations.items.create(conversation_id=cid, items=items)\nexcept ValueError as e:\n    raise RuntimeError(f\"bad request arguments: {e}\") from e","preventionTips":["Use keyword arguments for path ids","Capture the create() response's id immediately"],"tags":["openai","conversations","items","path-parameter","valueerror"],"backgroundTag":"missing-required-path-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}