{"record":{"id":"d2394f2611168e0b","repo":"openai/openai-python","slug":"expected-a-non-empty-value-for-message-id-but-re","errorCode":null,"errorMessage":"Expected a non-empty value for `message_id` but received {message_id!r}","messagePattern":"Expected a non-empty value for `message_id` but received (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/beta/threads/messages.py","lineNumber":149,"sourceCode":"        extra_body: Body | None = None,\n        timeout: float | httpx2.Timeout | None | NotGiven = not_given,\n    ) -> Message:\n        \"\"\"\n        Retrieve a message.\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 thread_id:\n            raise ValueError(f\"Expected a non-empty value for `thread_id` but received {thread_id!r}\")\n        if not message_id:\n            raise ValueError(f\"Expected a non-empty value for `message_id` but received {message_id!r}\")\n        extra_headers = {\"OpenAI-Beta\": \"assistants=v2\", **(extra_headers or {})}\n        return self._get(\n            path_template(\"/threads/{thread_id}/messages/{message_id}\", thread_id=thread_id, message_id=message_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={\"bearer_auth\": True},\n            ),\n            cast_to=Message,\n        )\n\n    @typing_extensions.deprecated(\"The Assistants API is deprecated in favor of the Responses API\")\n    def update(\n        self,\n        message_id: str,\n        *,","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/beta/threads/messages.py#L131-L167","documentation":"client.beta.threads.messages.retrieve() also requires a non-empty message_id for the GET /threads/{thread_id}/messages/{message_id} path. It is validated after thread_id, so you only see this error when thread_id is valid but message_id is empty/None.","triggerScenarios":"Calling retrieve with a valid thread_id but message_id=\"\" or None — commonly passing the whole Message object or the thread id by mistake in the second argument.","commonSituations":"Argument-order mix-ups (message_id=thread_id), ids from truncated logs/URLs, or deserialized records missing the message id.","solutions":["Pass the message's id: client.beta.threads.messages.retrieve(thread_id=tid, message_id=message.id)","Double-check argument order and that the value is the id string","Validate externally sourced ids before the call"],"exampleFix":"# before\nclient.beta.threads.messages.retrieve(thread_id=tid, message_id=\"\")\n# after\nclient.beta.threads.messages.retrieve(thread_id=tid, message_id=message.id)","handlingStrategy":"type-guard","validationCode":"if not (isinstance(message_id, str) and message_id):\n    raise ValueError(\"message_id must be a non-empty string\")","typeGuard":"def is_message_id(v: object) -> bool:\n    return isinstance(v, str) and v.startswith(\"msg_\") and len(v) > 4","tryCatchPattern":null,"preventionTips":["Pass message.id, never the Message object","Use keyword arguments to avoid positional mix-ups"],"tags":["python","validation","required-parameter","threads","assistants"],"backgroundTag":"missing-required-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}