{"record":{"id":"694263126871898c","repo":"openai/openai-python","slug":"id-must-be-provided-when-streaming-an-existing-res","errorCode":null,"errorMessage":"id must be provided when streaming an existing response","messagePattern":"id must be provided when streaming an existing response","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/responses/responses.py","lineNumber":1284,"sourceCode":"                top_p=top_p,\n                truncation=truncation,\n                user=user,\n                background=background,\n                extra_headers=extra_headers,\n                extra_query=extra_query,\n                extra_body=extra_body,\n                timeout=timeout,\n            )\n\n            return ResponseStreamManager(\n                api_request,\n                text_format=text_format,\n                input_tools=tools,\n                starting_after=None,\n            )\n        else:\n            if not is_given(response_id):\n                raise ValueError(\"id must be provided when streaming an existing response\")\n\n            return ResponseStreamManager(\n                lambda: self.retrieve(\n                    response_id=response_id,\n                    stream=True,\n                    include=include or [],\n                    extra_headers=extra_headers,\n                    extra_query=extra_query,\n                    extra_body=extra_body,\n                    starting_after=omit,\n                    timeout=timeout,\n                ),\n                text_format=text_format,\n                input_tools=tools,\n                starting_after=starting_after if is_given(starting_after) else None,\n            )\n\n    def parse(","sourceCodeStart":1266,"sourceCodeEnd":1302,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/responses/responses.py#L1266-L1302","documentation":"Raised by Responses.stream() when neither new-response arguments nor a response_id are given. To stream, you must either create a new response (input+model) or resume streaming an existing one by id; the SDK enforces this fork client-side.","triggerScenarios":"Calling client.responses.stream() with no create arguments and no response_id, e.g. client.responses.stream(stream=True) or all arguments defaulted/NotGiven.","commonSituations":"Passing response_id=None from a variable that was never populated (e.g. upstream response object missing .id); building a generic wrapper that conditionally streams and forgetting to forward the id.","solutions":["Pass the id of an existing response: client.responses.stream(response_id='resp_abc')","Or provide input and model to create and stream a new response","Check that the variable holding the id is not None before calling stream()"],"exampleFix":"// before\nclient.responses.stream()  # nothing given\n// after\nclient.responses.stream(response_id=\"resp_abc\")","handlingStrategy":"validation","validationCode":"from openai._utils import is_given\nif not is_given(response_id) and not any(is_given(v) for k, v in kwargs.items() if k in CREATE_ARGS):\n    raise ValueError('provide either response_id or input+model to stream()')","typeGuard":"def can_stream(response_id, input, model) -> bool:\n    return (isinstance(response_id, str) and response_id) or (bool(input) and bool(model))","tryCatchPattern":"try:\n    with client.responses.stream(...) as s:\n        ...\nexcept ValueError as e:\n    if 'streaming an existing response' in str(e):\n        s = client.responses.stream(response_id=stored_id)\n    else:\n        raise","preventionTips":["Decide up front whether you are creating or resuming a stream","Persist response ids right after creation for later resumption","Never call stream() with every argument defaulted"],"tags":["responses","stream","missing-argument","validation","python"],"backgroundTag":"missing-required-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}