Skip to content

Missing "id" field in tool‑call response causes AI_InvalidResponseDataError #182

@chindris-mihai-alexandru

Description

Description
When calling the Devstral-2-123B-Instruct-2512 model via the NVIDIA NIM OpenAI‑compatible endpoint (used from OpenCode), the JSON payload returned for a tool‑call does not contain an id field (or the field is null). OpenCode’s SDK validates the response and throws:

AI_InvalidResponseDataError: Expected "id" to be a string

Reproduction steps

  1. Set NVIDIA_NIM_KEY to a valid key.
  2. Run the curl command from the NVIDIA issue (see below).
  3. Observe the raw response – the "id" property is missing.

Actual behaviour

Expected behaviour
Every response object should include an "id" string (e.g., "id": "msg_01abcd...").

Suggested fix
Add a mandatory "id" string to the response payload (or generate a UUID server‑side when the field is missing). If the field is optional, the SDK should fallback to a generated UUID instead of crashing.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions