n8n-io/n8n · error · Error

Assistant SDK error: ${remaining.substring(0, 500)}

Error message

Assistant SDK error: ${remaining.substring(0, 500)}

What it means

Error "Assistant SDK error: ${remaining.substring(0, 500)}" thrown in n8n-io/n8n.

Source

Thrown at packages/@n8n/ai-workflow-builder.ee/src/assistant/assistant-handler.ts:227

						continue;
					}

					await this.processChunkMessages(chunk, state, writer, toolCallId, context);
				}
			}
		} finally {
			reader.releaseLock();
		}

		const remaining = buffer.trim();
		if (remaining) {
			try {
				const chunk = JSON.parse(remaining) as SdkStreamChunk;
				await this.processChunkMessages(chunk, state, writer, toolCallId, context);
			} catch {
				// If the remaining buffer is not JSON, it's likely a plain-text error from the SDK.
				// Throw so callers can handle it as a proper error instead of an empty response.
				throw new Error(`Assistant SDK error: ${remaining.substring(0, 500)}`);
			}
		}

		const responseText = state.collectedTexts.join('\n');
		const summary =
			responseText.length > SUMMARY_MAX_LENGTH
				? responseText.substring(0, SUMMARY_MAX_LENGTH) + '...'
				: responseText;

		return {
			responseText,
			summary,
			sdkSessionId: state.sdkSessionId,
			hasCodeDiff: state.hasCodeDiff,
			suggestionIds: state.suggestionIds,
		};
	}

View on GitHub (pinned to 5ac6606e81)

When it happens

Trigger: Thrown at packages/@n8n/ai-workflow-builder.ee/src/assistant/assistant-handler.ts:227 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/9b677003522b5981. Report an issue: GitHub.