type 'reasoning' was provided without its required following item. #1734

Closed
opened 2026-02-16 17:32:23 -05:00 by yindo · 5 comments
Owner

Originally created by @vishawdeepsingh-dev on GitHub (Sep 16, 2025).

Originally assigned to: @thdxr on GitHub.

I recently purchased opencode zen but on selecting GPT 5 open code this error is coming

Image
Originally created by @vishawdeepsingh-dev on GitHub (Sep 16, 2025). Originally assigned to: @thdxr on GitHub. I recently purchased opencode zen but on selecting GPT 5 open code this error is coming <img width="1399" height="70" alt="Image" src="https://github.com/user-attachments/assets/969ebbf6-116c-40b4-a180-a39ccc60c66d" />
yindo closed this issue 2026-02-16 17:32:23 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 16, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2610: Same exact error message with GPT-5 - "AI_APICallError: Item '...' of type 'reasoning' was provided without its required following item"

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 16, 2025): This issue might be a duplicate of existing issues. Please check: - #2610: Same exact error message with GPT-5 - "AI_APICallError: Item '...' of type 'reasoning' was provided without its required following item" Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Sep 16, 2025):

related: #2610

@rekram1-node commented on GitHub (Sep 16, 2025): related: #2610
Author
Owner

@rekram1-node commented on GitHub (Sep 16, 2025):

BTW:

In your opencode.json:

{
  "providers": {
      "opencode": {
      "models": {
        "gpt-5": {
          "options": {
            "reasoningSummary": null,
            "include": []
          }
        }
      }
    }
   }
}

that should fix it
this basically just makes it so openai doesn't ssend the reasoning summaries, it shouldn't impact model performance afaik
this is temporary fix^^

@rekram1-node commented on GitHub (Sep 16, 2025): BTW: In your opencode.json: ``` { "providers": { "opencode": { "models": { "gpt-5": { "options": { "reasoningSummary": null, "include": [] } } } } } } ``` that should fix it this basically just makes it so openai doesn't ssend the reasoning summaries, it shouldn't impact model performance afaik this is temporary fix^^
Author
Owner

@thdxr commented on GitHub (Sep 17, 2025):

we disabled the thing that was causing this

@thdxr commented on GitHub (Sep 17, 2025): we disabled the thing that was causing this
Author
Owner

@ferenci84 commented on GitHub (Sep 24, 2025):

I commented this to an other issue, but copy here too:

I just resolved a similar issue while I was implementing the responses API endpoint support in Continue.dev. The easiest resolution of the issue is to save the id field for all LLM-generated blocks and feed it back to the model. The problem with not including the encrypted_content is that the reasoning is lost between the tool calls, and the model have to think again.

Below is my findings in details:

Actual input (with bug):

{
  "input": [
    {
      "role": "developer",
      "content": "[REDACTED_LONG_TEXT]"
    },
    {
      "role": "developer", 
      "content": "[REDACTED_LONG_TEXT]"
    },
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Show me the file tree of the ./src directory. Use the bash tool."
        }
      ]
    },
    {
      "type": "reasoning",
      "id": "rs_68d39705879881968df1eb77287e9d280454b285d187bb88",
      "summary": [
        {
          "type": "summary_text",
          "text": "**Exploring command options**\n\n[REDACTED_REASONING_CONTENT]"
        },
        {
          "type": "summary_text", 
          "text": "**Planning Python file listing**\n\n[REDACTED_REASONING_CONTENT]"
        },
        {
          "type": "summary_text",
          "text": "**Implementing file tree logic**\n\n[REDACTED_REASONING_CONTENT]"
        },
        {
          "type": "summary_text",
          "text": "**Implementing Python tree structure**\n\n[REDACTED_REASONING_CONTENT]"
        },
        {
          "type": "summary_text", 
          "text": "**Constructing command for file tree**\n\n[REDACTED_REASONING_CONTENT]"
        }
      ]
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Goal: Display a tree view of the ./src directory using the bash tool.\n\nPlan:\n- Use a Python one-liner via bash to recursively walk the src directory and print a hierarchical tree.\n- Avoid disallowed commands like ls/find/grep and ensure paths are quoted and absolute.\n- Return the printed tree directly.\n\nExecuting now..."
        }
      ]
    },
    {
      "type": "function_call",
      "call_id": "call_LzJHggt1Y0E5vEI2AZuGexvG", 
      "name": "bash",
      "arguments": "{\"command\":\"python3 -c \\\"import os; from pathlib import Path; root=Path('./src'); print(root.name); import sys; \\nfor current, dirs, files in os.walk(root):\\n    current=Path(current); depth = 0 if current==root else len(current.relative_to(root).parts); indent = '    ' * depth; \\n    if current != root: print(indent + current.name); \\n    for f in sorted(files): print(indent + '    ' + f)\\\"\",\"timeout\":120000,\"description\":\"Prints tree view of src directory\"}"
    },
    {
      "type": "function_call_output",
      "call_id": "call_LzJHggt1Y0E5vEI2AZuGexvG",
      "output": "[REDACTED_LONG_OUTPUT]"
    }
  ]
}

Working input:

{
  "input": [
    {
      "role": "developer",
      "content": "You are intelligent, helpful and an expert developer, who always gives the correct answer and follow instructions.",
      "type": "message"
    },
    {
      "role": "user", 
      "content": "Show me the file tree of the ./src directory. Use the run_terminal_command tool.",
      "type": "message"
    },
    {
      "id": "rs_68d399138740819494f52fc24c0cd08a0632cb035d829222",
      "type": "reasoning", 
      "summary": [
        {
          "type": "summary_text",
          "text": "**Executing terminal command**\n\n[REDACTED_REASONING_CONTENT]"
        }
      ],
      "encrypted_content": "gAAAAABo05kTutMoY2GZA4Be61B99_WBl4Kd3RuMHfExK8SUGT0XQzsNx_pBPpNHLPre3b8q8OYqJVBAzn4yFbS8MQIpAAz1MIu2VpvGs6osIlYWXDx85OxEJJPgm-NJob7NV4MZ9t1jJpQ9fWvEhFWTwmbZKC_2pU2D7datNQvMuLuNvsMHlQwNdxO043-y4dXL7hWBOZ9GsmUrTHqyDXOM9zYTZQF1B51W59-THzKmFPoHne4vMC5qstxwrMF7FjoWYO2mE7O5Yrot347uhdf9nimvJ7SkIzXgkmo8g-81o3MBJh-sulJhMZuj3Deot06BHaz31c_4faSNqTUO-NMitRvJZm_GhOl1K7o0I_NYMoRSX50cJw6Q1dV8lMpFcwCloyKBG-hnsyNQOyk9Zff92S1Ox59PKU2QAPo7kD8PcR6oMosZ2lVJtijSQdWJdb6fPf822qqbVhKLWsrbg-CVjoAmur9NL3UYH9jtu-B1Z1K14MmbMzAMxCbvxIGqV_Rl_nx0X5jJsIpIzrVjfYSAxkd1SIudR8ekenWEJ98DHQFIQgBInYm_Ildb6TzXMgXCddoOaZORzJfQ_yLgpERYqDlbCnQ3EY76uNaih7lsvdpx7UHYV2MUJKSjqcDoxZ3R5i8jkCk0X_U8Hs8JUEj9ei40ju9aCpQJsGqmvWbnjzmYQ8YuZh2JvCkfU40S56Ny5bQt1m_GfVaPXZvZte5udkrn9-8vV9x6JXgW3gtVDe5Drw6N0lvmxw1GhIQzjiJvtRace6WW_mtctx_ygD6FK4G2oWhRjMwkgaksK9bwHxszLgzCvH4="
    },
    {
      "id": "fc_68d3991a25c481948ed501f489af4b9c0632cb035d829222",
      "type": "function_call",
      "name": "run_terminal_command", 
      "arguments": "{\"command\": \"ls -laR ./src\", \"waitForCompletion\": true}",
      "call_id": "call_E2EH6FD4vea7tWphlai0HVDo"
    },
    {
      "type": "function_call_output",
      "call_id": "call_E2EH6FD4vea7tWphlai0HVDo",
      "output": "[REDACTED_LONG_OUTPUT]"
    }
  ]
}

Differences:

  • In the opencode generated input, the ID is missing from the tool call - this is what causes the
  • encrypted content is not fed back to the model - this doesn't cause API error, but the model may need to rethink everything after each tool call

Note: The above buggy input was generated with the version 0.11.3. I am using the 0.7.9 version, and it's generated input is similar to the above "Working input", it has the id in the function call, and has the encrypted_content in the reasoning blocks.

@ferenci84 commented on GitHub (Sep 24, 2025): I commented this to an other issue, but copy here too: I just resolved a similar issue while I was implementing the responses API endpoint support in Continue.dev. The easiest resolution of the issue is to save the `id` field for all LLM-generated blocks and feed it back to the model. The problem with not including the encrypted_content is that the reasoning is lost between the tool calls, and the model have to think again. Below is my findings in details: **Actual input (with bug):** ```json { "input": [ { "role": "developer", "content": "[REDACTED_LONG_TEXT]" }, { "role": "developer", "content": "[REDACTED_LONG_TEXT]" }, { "role": "user", "content": [ { "type": "input_text", "text": "Show me the file tree of the ./src directory. Use the bash tool." } ] }, { "type": "reasoning", "id": "rs_68d39705879881968df1eb77287e9d280454b285d187bb88", "summary": [ { "type": "summary_text", "text": "**Exploring command options**\n\n[REDACTED_REASONING_CONTENT]" }, { "type": "summary_text", "text": "**Planning Python file listing**\n\n[REDACTED_REASONING_CONTENT]" }, { "type": "summary_text", "text": "**Implementing file tree logic**\n\n[REDACTED_REASONING_CONTENT]" }, { "type": "summary_text", "text": "**Implementing Python tree structure**\n\n[REDACTED_REASONING_CONTENT]" }, { "type": "summary_text", "text": "**Constructing command for file tree**\n\n[REDACTED_REASONING_CONTENT]" } ] }, { "role": "assistant", "content": [ { "type": "output_text", "text": "Goal: Display a tree view of the ./src directory using the bash tool.\n\nPlan:\n- Use a Python one-liner via bash to recursively walk the src directory and print a hierarchical tree.\n- Avoid disallowed commands like ls/find/grep and ensure paths are quoted and absolute.\n- Return the printed tree directly.\n\nExecuting now..." } ] }, { "type": "function_call", "call_id": "call_LzJHggt1Y0E5vEI2AZuGexvG", "name": "bash", "arguments": "{\"command\":\"python3 -c \\\"import os; from pathlib import Path; root=Path('./src'); print(root.name); import sys; \\nfor current, dirs, files in os.walk(root):\\n current=Path(current); depth = 0 if current==root else len(current.relative_to(root).parts); indent = ' ' * depth; \\n if current != root: print(indent + current.name); \\n for f in sorted(files): print(indent + ' ' + f)\\\"\",\"timeout\":120000,\"description\":\"Prints tree view of src directory\"}" }, { "type": "function_call_output", "call_id": "call_LzJHggt1Y0E5vEI2AZuGexvG", "output": "[REDACTED_LONG_OUTPUT]" } ] } ``` **Working input:** ```json { "input": [ { "role": "developer", "content": "You are intelligent, helpful and an expert developer, who always gives the correct answer and follow instructions.", "type": "message" }, { "role": "user", "content": "Show me the file tree of the ./src directory. Use the run_terminal_command tool.", "type": "message" }, { "id": "rs_68d399138740819494f52fc24c0cd08a0632cb035d829222", "type": "reasoning", "summary": [ { "type": "summary_text", "text": "**Executing terminal command**\n\n[REDACTED_REASONING_CONTENT]" } ], "encrypted_content": "gAAAAABo05kTutMoY2GZA4Be61B99_WBl4Kd3RuMHfExK8SUGT0XQzsNx_pBPpNHLPre3b8q8OYqJVBAzn4yFbS8MQIpAAz1MIu2VpvGs6osIlYWXDx85OxEJJPgm-NJob7NV4MZ9t1jJpQ9fWvEhFWTwmbZKC_2pU2D7datNQvMuLuNvsMHlQwNdxO043-y4dXL7hWBOZ9GsmUrTHqyDXOM9zYTZQF1B51W59-THzKmFPoHne4vMC5qstxwrMF7FjoWYO2mE7O5Yrot347uhdf9nimvJ7SkIzXgkmo8g-81o3MBJh-sulJhMZuj3Deot06BHaz31c_4faSNqTUO-NMitRvJZm_GhOl1K7o0I_NYMoRSX50cJw6Q1dV8lMpFcwCloyKBG-hnsyNQOyk9Zff92S1Ox59PKU2QAPo7kD8PcR6oMosZ2lVJtijSQdWJdb6fPf822qqbVhKLWsrbg-CVjoAmur9NL3UYH9jtu-B1Z1K14MmbMzAMxCbvxIGqV_Rl_nx0X5jJsIpIzrVjfYSAxkd1SIudR8ekenWEJ98DHQFIQgBInYm_Ildb6TzXMgXCddoOaZORzJfQ_yLgpERYqDlbCnQ3EY76uNaih7lsvdpx7UHYV2MUJKSjqcDoxZ3R5i8jkCk0X_U8Hs8JUEj9ei40ju9aCpQJsGqmvWbnjzmYQ8YuZh2JvCkfU40S56Ny5bQt1m_GfVaPXZvZte5udkrn9-8vV9x6JXgW3gtVDe5Drw6N0lvmxw1GhIQzjiJvtRace6WW_mtctx_ygD6FK4G2oWhRjMwkgaksK9bwHxszLgzCvH4=" }, { "id": "fc_68d3991a25c481948ed501f489af4b9c0632cb035d829222", "type": "function_call", "name": "run_terminal_command", "arguments": "{\"command\": \"ls -laR ./src\", \"waitForCompletion\": true}", "call_id": "call_E2EH6FD4vea7tWphlai0HVDo" }, { "type": "function_call_output", "call_id": "call_E2EH6FD4vea7tWphlai0HVDo", "output": "[REDACTED_LONG_OUTPUT]" } ] } ``` Differences: - In the opencode generated input, the ID is missing from the tool call - this is what causes the - encrypted content is not fed back to the model - this doesn't cause API error, but the model may need to rethink everything after each tool call Note: The above buggy input was generated with the version 0.11.3. I am using the 0.7.9 version, and it's generated input is similar to the above "Working input", it has the `id` in the function call, and has the `encrypted_content` in the reasoning blocks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1734