Skip to content

Edit tool fails with GPT-5.4: 400 Invalid type for 'messages[x].tool_calls[x].type': expected one of 'function', 'all...ols', or 'custom', but got null instead. #31695

@tsm-harmoney

Description

@tsm-harmoney

Summary

After upgrading from v0.68.3 to v0.71.5 (and later testing v0.72.1), developer agents consistently fail when using the edit tool with OpenAI GPT models.

The same workflow works correctly with Claude Sonnet 4.6.

The failure appears related to malformed OpenAI tool-call serialization where tool_calls[].type becomes null.

Error

● Edit
  │ Edit
  │ back-end/app/src/main/java/eu/foobar/internal/services/RootService.java
  └ Edit back-end/app/src/test/java/eu/foobar/internal/services/RootServiceI
    Test.java

● Request failed (transient_bad_request). Retrying...

● Request failed (transient_bad_request). Retrying...


400 Invalid type for 'messages[43].tool_calls[1].type': expected one of 'function', 'all...ols', or 'custom', but got null instead.

Changes   +2 -2
Duration  1m 8s
Tokens    ↑ 571.3k • ↓ 5.6k • 482.2k (cached)
[copilot-harness] 2026-05-09T08:57:59.150Z attempt 1: process exit event exitCode=1
[copilot-harness] 2026-05-09T08:57:59.153Z attempt 1: process closed exitCode=1 duration=1m 9s stdout=11004B stderr=220B hasOutput=true
[copilot-harness] 2026-05-09T08:57:59.153Z attempt 1 failed: exitCode=1 isCAPIError400=false isMCPPolicyError=false isModelNotSupportedError=false isNullTypeToolCallError=true isAuthError=false hasOutput=true retriesRemaining=3
[copilot-harness] 2026-05-09T08:57:59.153Z attempt 1: null-type tool_call error (fresh run) — restarting fresh (poisoned history discarded; --continue disabled permanently)
[copilot-harness] 2026-05-09T08:57:59.153Z retry 1/3: sleeping 5000ms before next attempt (fresh run)
[copilot-harness] 2026-05-09T08:58:04.157Z retry 1/3: woke up, next delay cap will be 20000ms
[copilot-harness] 2026-05-09T08:58:04.157Z attempt 2: spawning: /usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --disable-builtin-mcps --no-ask-user --allow-all-tools --allow-all-paths --add-dir /home/runner/work/foobar/foobar -p
[copilot-harness] 2026-05-09T08:58:04.160Z attempt 2: process started (pid=735)

Environment

gh-aw: v0.71.5 and v0.72.1
Previously working: v0.68.3
Engine: copilot-cli
Failing models: gpt-5.4
Working models: claude-sonnet-4.6

Run details - copilot 1.0.40

engine id: copilot
engine name: GitHub Copilot CLI
model: gpt-5.4
version: 1.0.40
agent version: 1.0.40
experimental: false
supports tools allowlist: true
run number: 80
run attempt: 1
ref: refs/heads/main
sha: f391c75574e141547c8edeef7bfd14e1e4aa5f74
event name: workflow_dispatch
staged: false
firewall enabled: true
awf version: v0.25.40
awmg version: (none)
steps: firewall: squid
created at: 2026-05-12T11:41:57.066Z
cli version: v0.71.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions