diegosouzapw/OmniRoute · error · Error

[ ]

Error message

[${res.status}] ${text}

What it means

Trae createSession POST to /chat_sessions returned a non-OK HTTP status; the raw status and response text are thrown so the caller sees why session creation failed (auth expiry, quota, invalid model selection, or server error).

Solutions

  1. Refresh credentials on 401/403 before retrying
  2. Back off on 429/5xx and retry session creation
  3. Log the embedded body to detect API contract changes
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at open-sse/executors/trae.ts:154 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/2bc1730489fb4b5d. Report an issue: GitHub.

Appendix: source

Thrown at open-sse/executors/trae.ts:154

        content: [],
        query,
        model_name: modelName,
        agent_type: "solo_agent_remote",
        model_selection_strategy: strategy,
        common_params: this.commonParams(psd, mode),
      },
      env: "remote",
      auto_create_project: false,
      origin: "web",
    };
    const res = await fetch(`${this.base()}/chat_sessions`, {
      method: "POST",
      headers,
      body: JSON.stringify(body),
      signal: signal || undefined,
    });
    const text = await res.text();
    if (!res.ok) throw new Error(`[${res.status}] ${text}`);
    const json = JSON.parse(text);
    if (json?.code !== 0) throw new Error(`Trae create_session: ${JSON.stringify(json)}`);
    return { sessionId: json.data.chat_session_id, messageId: json.data.message_id };
  }

  /**
   * GET /events SSE → invoke onEvent(eventType, dataObj) per frame.
   * Resolves when `done`/`error` arrives, the stream ends, or timeout fires.
   */
  private async streamEvents(
    headers: Record<string, string>,
    sessionId: string,
    replyTo: string,
    onEvent: (ev: string | null, data: JsonRecord) => boolean,
    signal?: AbortSignal | null
  ): Promise<void> {
    const url = `${this.base()}/chat_sessions/${sessionId}/events?reply_to_message_id=${encodeURIComponent(replyTo)}`;
    const ctrl = new AbortController();

View on GitHub (pinned to a179ffed5b)