Requests fail with the "Interrupted by user." error
The error repeats when the request is repeated.
Version: 1.17.2 Request: Write a Hello World program in Rust. Provider: ollama2, Model: qwen3-coder OS: FreeBSD 15 STABLE
Thanks for this. Will take a look 👍
Hey @yurivict - we have since pushed a couple of large updates that change the way Nanocoder under the hood works So this may well be fixed.
Are you able to firstly, update to v1.19.0 and try again. If the problem still persists, I'd @Avtrkrb to jump in here and tell you how to get us logs :)
Root Cause Analysis
Status: Issue confirmed still valid after code review.
Location: source/ai-sdk-client/chat/chat-handler.ts (lines 255-264)
The Bug
// Line 230-237: Correctly handles actual user cancellation
if (error instanceof Error && error.name === 'AbortError') {
throw new Error('Operation was cancelled'); // ✓ Correct
}
// Line 255-264: Incorrectly assumes NoOutputGeneratedError = cancellation
if (error.name === 'AI_NoOutputGeneratedError' ||
error.message.includes('No output generated')) {
const rootError = extractRootError(error);
if (rootError === error) {
// BUG: Assumes empty response = user cancelled
throw new Error('Operation was cancelled'); // ✗ Wrong
}
}
Why This Happens
- Real user cancellation throws
AbortError→ handled correctly at line 230 - When model returns empty response, AI SDK throws
AI_NoOutputGeneratedError - Since there's no nested API error, line 262-264 falsely reports "Interrupted by user"
This explains the FreeBSD + Ollama + qwen3-coder behavior - the model likely returns empty responses for certain prompts.
Proposed Fix
Check signal?.aborted before treating as cancellation:
if (rootError === error) {
if (signal?.aborted) {
throw new Error('Operation was cancelled');
}
// Model returned empty - NOT a user cancellation
throw new Error('Model returned empty response. Try again or use a different model.');
}
Confidence: High