{"record":{"id":"694b7df2d598561e","repo":"openai/openai-python","slug":"input-must-be-provided-when-creating-a-new-respons","errorCode":null,"errorMessage":"input must be provided when creating a new response","messagePattern":"input must be provided when creating a new response","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/responses/responses.py","lineNumber":1222,"sourceCode":"            \"text\": text,\n            \"tool_choice\": tool_choice,\n            \"top_logprobs\": top_logprobs,\n            \"top_p\": top_p,\n            \"truncation\": truncation,\n            \"user\": user,\n            \"background\": background,\n        }\n        new_response_args_names = [k for k, v in new_response_args.items() if is_given(v)]\n\n        if (is_given(response_id) or is_given(starting_after)) and len(new_response_args_names) > 0:\n            raise ValueError(\n                \"Cannot provide both response_id/starting_after can't be provided together with \"\n                + \", \".join(new_response_args_names)\n            )\n        tools = _make_tools(tools)\n        if len(new_response_args_names) > 0:\n            if not is_given(input):\n                raise ValueError(\"input must be provided when creating a new response\")\n\n            if not is_given(model):\n                raise ValueError(\"model must be provided when creating a new response\")\n\n            if is_given(text_format):\n                if not text:\n                    text = {}\n\n                if \"format\" in text:\n                    raise TypeError(\"Cannot mix and match text.format with text_format\")\n\n                text = copy(text)\n                text[\"format\"] = _type_to_text_format_param(text_format)\n\n            api_request: partial[Stream[ResponseStreamEvent]] = partial(\n                self.create,\n                input=input,\n                model=model,","sourceCodeStart":1204,"sourceCodeEnd":1240,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/responses/responses.py#L1204-L1240","documentation":"Raised by Responses.stream() when you pass new-response arguments (e.g. model) but omit `input`. A streaming response creation requires an input payload; without it the SDK cannot construct the create request, so it fails before any network call.","triggerScenarios":"client.responses.stream(model=\"gpt-4o\") with no input= argument (input defaults to NOT_GIVEN).","commonSituations":"Assuming a prompt from a previous turn persists (it does not — each create is stateless unless using previous_response_id), or building the input list conditionally and skipping it when empty.","solutions":["Provide input: client.responses.stream(model=..., input=\"hello\") or a list of input items","If you meant to continue a previous conversation, use response_id (continuation mode) instead of re-sending model","Ensure conditional input-building code always yields at least one item"],"exampleFix":"# before\nstream = client.responses.stream(model=\"gpt-4o\")\n# after\nstream = client.responses.stream(model=\"gpt-4o\", input=\"Summarize this transcript...\")","handlingStrategy":"validation","validationCode":"if input is None or (isinstance(input, list) and not input):\n    if response_id is None:\n        raise ValueError(\"input is required to create a new streamed response\")","typeGuard":"def has_stream_input(input) -> bool:\n    return bool(input is not None) and (not isinstance(input, list) or len(input) > 0)","tryCatchPattern":"try:\n    stream = client.responses.stream(model=model, input=input)\nexcept ValueError as e:\n    if \"input must be provided\" in str(e):\n        input = build_default_input()\n        stream = client.responses.stream(model=model, input=input)\n    else:\n        raise","preventionTips":["Always pair model with input when creating","Use response_id continuation instead of re-sending prompts for follow-ups","Ensure conditional input builders never return empty"],"tags":["responses","streaming","parameter-validation","missing-input"],"backgroundTag":"missing-required-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}