{"record":{"id":"24b345bb2defa7d9","repo":"openai/openai-python","slug":"cannot-provide-both-response-id-starting-after-can","errorCode":null,"errorMessage":"Cannot provide both response_id/starting_after can't be provided together with \", \".join(new_response_args_names)","messagePattern":"Cannot provide both response_id/starting_after can't be provided together with \", \"\\.join\\(new_response_args_names\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/resources/responses/responses.py","lineNumber":1215,"sourceCode":"            \"prompt_cache_retention\": prompt_cache_retention,\n            \"reasoning\": reasoning,\n            \"safety_identifier\": safety_identifier,\n            \"service_tier\": service_tier,\n            \"store\": store,\n            \"stream_options\": stream_options,\n            \"temperature\": temperature,\n            \"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","sourceCodeStart":1197,"sourceCodeEnd":1233,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/resources/responses/responses.py#L1197-L1233","documentation":"Raised by Responses.stream() when you mix continuation arguments (response_id or starting_after) with arguments that create a brand-new response (model, input, instructions, tools, etc.). The stream API supports two modes — resuming/forking an existing response or creating a new one — and supplying both is ambiguous, so the SDK raises ValueError listing the offending new-response args.","triggerScenarios":"client.responses.stream(response_id=\"resp_...\", model=\"gpt-4o\", input=[...]) — any of model/input/instructions/tools/temperature/... given together with response_id or starting_after.","commonSituations":"Refactoring code from create-then-stream to resume-style streaming while leaving old parameters in place; copy-pasting a full parameter set and adding response_id for retries.","solutions":["To continue/fork an existing response: remove model/input/etc. and pass only response_id (plus starting_after/output items as needed)","To create a new streamed response: remove response_id and starting_after","Audit the call site for leftover parameters from the other mode; the error message names the conflicting arguments"],"exampleFix":"# before\nstream = client.responses.stream(\n    response_id=\"resp_123\", model=\"gpt-4o\", input=\"hi\"\n)\n# after (continue existing)\nstream = client.responses.stream(response_id=\"resp_123\")","handlingStrategy":"type-guard","validationCode":"NEW_RESPONSE_ARGS = {\"model\", \"input\", \"instructions\", \"tools\", \"temperature\", \"top_p\", \"max_output_tokens\", \"metadata\", \"text\", \"reasoning\", \"user\", \"background\"}\ncontinuing = response_id is not None or starting_after is not None\ncreating = any(kwargs.get(k) is not None for k in NEW_RESPONSE_ARGS)\nif continuing and creating:\n    raise ValueError(\"pick one mode: response_id/starting_after OR new-response args\")","typeGuard":"def is_pure_continuation(response_id, starting_after, **new_args) -> bool:\n    given_new = [k for k, v in new_args.items() if v is not None]\n    return (response_id is not None or starting_after is not None) and not given_new","tryCatchPattern":"try:\n    stream = client.responses.stream(**params)\nexcept ValueError as e:\n    if \"Cannot provide both\" in str(e):\n        params.pop(\"response_id\", None); params.pop(\"starting_after\", None)\n        stream = client.responses.stream(**params)\n    else:\n        raise","preventionTips":["Wrap stream() calls in a small wrapper that enforces one mode","Keep create-mode and continue-mode call sites separate","Read the error message: it lists the conflicting arguments"],"tags":["responses","streaming","parameter-validation","api-misuse"],"backgroundTag":"conflicting-parameters","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}