Description
OpenCode crashes with AI_InvalidResponseDataError: Expected "id" to be a string when the NVIDIA NIM endpoint returns a tool‑call response without an id field.
Reproduction steps
- Obtain a valid
NVIDIA_NIM_KEY.
- Run the curl command from the NVIDIA issue (see that issue for the exact command).
- The raw JSON response from NIM does not contain an
id property.
- OpenCode validates the payload and throws the error.
Expected behaviour
If the id field is missing or not a string, the integration should automatically generate a temporary UUID (e.g., msg_<uuid>) and continue processing instead of aborting.
Suggested implementation
function normalizeMistralResponse(resp: any): any {
if (!resp.id || typeof resp.id !== "string") {
resp.id = `msg_${crypto.randomUUID()}`;
}
return resp;
}
Add this guard before any SDK validation that expects id.
Impact
All users who call any NVIDIA NIM model from OpenCode will stop crashing.
Environment
Description
OpenCode crashes with
AI_InvalidResponseDataError: Expected "id" to be a stringwhen the NVIDIA NIM endpoint returns a tool‑call response without anidfield.Reproduction steps
NVIDIA_NIM_KEY.idproperty.Expected behaviour
If the
idfield is missing or not a string, the integration should automatically generate a temporary UUID (e.g.,msg_<uuid>) and continue processing instead of aborting.Suggested implementation
Add this guard before any SDK validation that expects
id.Impact
All users who call any NVIDIA NIM model from OpenCode will stop crashing.
Environment