earendil-works/pi · error · TypeError

Assistant error messages must not be empty

Error message

Assistant error messages must not be empty

What it means

Error "Assistant error messages must not be empty" thrown in earendil-works/pi.

Source

Thrown at packages/server/src/protocol.ts:317

		...(usage ? { usage } : {}),
		timestamp: timestamp(message.timestamp),
	} as const;
	switch (message.stopReason) {
		case "pending":
			return { ...common, status: "streaming" } satisfies AssistantTranscriptItem;
		case "stop":
		case "length":
		case "toolUse":
			return {
				...common,
				status: "complete",
				stopReason: message.stopReason,
			} satisfies AssistantTranscriptItem;
		case "deferred":
			throw new TypeError("Deferred assistant messages are not supported by protocol v1");
		case "error":
			if (message.errorMessage?.length === 0) {
				throw new TypeError("Assistant error messages must not be empty");
			}
			return {
				...common,
				status: "error",
				stopReason: "error",
				...(message.errorMessage === undefined ? {} : { errorMessage: message.errorMessage }),
			} satisfies AssistantTranscriptItem;
		case "aborted":
			return {
				...common,
				status: "aborted",
				stopReason: "aborted",
				...(message.errorMessage === undefined ? {} : { errorMessage: message.errorMessage }),
			} satisfies AssistantTranscriptItem;
		default: {
			const exhaustive: never = message.stopReason;
			return exhaustive;
		}

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Include a non-empty error message on assistant error messages.

When it happens

Trigger: Thrown at packages/server/src/protocol.ts:317 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/54fa2ac5369311b2. Report an issue: GitHub.