Skip to content

HeadersTimeoutError after 5 minutes when using @opencode-ai/sdk versions > 1.3.3 #20119

Description

@eliavamar

Description

When using @opencode-ai/sdk version 1.3.4 or higher (up to the current latest 1.3.7), the SDK fails with a HeadersTimeoutError after approximately 5 minutes of operation. This issue does not occur in version 1.3.3, which works correctly.

The error occurs during SDK operations (specifically when calling client.session.prompt()), suggesting a timeout configuration change or network handling regression was introduced after version 1.3.3.

code = 'UND_ERR_HEADERS_TIMEOUT'
message = 'Headers Timeout Error'
name = 'HeadersTimeoutError'
stack = 'HeadersTimeoutError: Headers Timeout Error
    at FastTimer.onParserTimeout [as _onTimeout] (node:internal/deps/undici/undici:6827:32)
    at Timeout.onTick [as _onTimeout] (node:internal/deps/undici/undici:528:17)
    at listOnTimeout (node:internal/timers:608:17)
    at process.processTimers (node:internal/timers:543:7)'

  • Affected versions: 1.3.4, 1.3.5, 1.3.6, 1.3.7 (all versions > 1.3.3)
  • Working version: 1.3.3
  • tested: @opencode-ai/sdk@1.3.3-7 and opencode-ai@1.3.3-7

Plugins

No response

OpenCode version

1.3.4, 1.3.5, 1.3.6, 1.3.7 (all versions > 1.3.3)

Steps to reproduce

  • Install @opencode-ai/sdk version 1.3.4 or higher
  • Create an OpenCode server and client:
import { createOpencodeClient, createOpencodeServer } from "@opencode-ai/sdk";

const server = await createOpencodeServer({
  hostname: "127.0.0.1",
  port: 4096,
});

const client = createOpencodeClient({
  baseUrl: "http://127.0.0.1:4096",
  directory: "/path/to/project",
  throwOnError: true,
});
  • Create a session and send a prompt:
const session = await client.session.create({
  body: { title: "My session" },
});

const result = await client.session.prompt({
  path: { id: session.data.id },
  body: {
    model: { providerID: "sap-ai-core", modelID: "anthropic--claude-4.5-haiku" },
    parts: [{ type: "text", text: "Hello!" }],
  },
});
  • Wait approximately 5 minutes
  • Observe the HeadersTimeoutError

Expected behavior: The operation should complete successfully (as it does in version 1.3.3)

Actual behavior After ~5 minutes, the operation fails with HeadersTimeoutError

Screenshot and/or share link

No response

Operating System

macOS Tahoe

Terminal

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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