earendil-works/pi · error

Mistral response has no body

Error message

Mistral response has no body

What it means

Error "Mistral response has no body" thrown in earendil-works/pi.

Source

Thrown at packages/ai/src/api/mistral-conversations.ts:313

	const url = new URL("v1/chat/completions", baseUrl);
	const headers = buildMistralHeaders(model, apiKey, options);
	const timeoutSignal = AbortSignal.timeout(options?.timeoutMs ?? 60_000);
	const signal = options?.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
	const response = await (options?.fetch ?? globalThis.fetch)(url, {
		method: "POST",
		headers,
		body: JSON.stringify(toMistralWirePayload(payload)),
		signal,
	});

	await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);

	if (!response.ok) {
		const body = await response.text();
		throw new MistralHttpError(response.status, body, response.statusText);
	}
	if (!response.body) {
		throw new Error("Mistral response has no body");
	}

	return readMistralEvents(response.body, signal);
}

class MistralHttpError extends Error {
	statusCode: number;
	body: string;

	constructor(statusCode: number, body: string, statusText: string) {
		super(statusText || `Request failed with status ${statusCode}`);
		this.name = "MistralHttpError";
		this.statusCode = statusCode;
		this.body = body;
	}
}

function buildMistralHeaders(model: Model<"mistral-conversations">, apiKey: string, options?: MistralOptions): Headers {

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Retry; verify the Mistral endpoint returns a streamed response body.

When it happens

Trigger: Thrown at packages/ai/src/api/mistral-conversations.ts:313 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/14ad1854e4d2d33b. Report an issue: GitHub.