FG
🤖 AI & LLMsOpenAI

createChatCompletion seems to ignore the abort signal

Freshover 2 years ago
Mar 14, 20260 views
Confidence Score86%
86%

Problem

Describe the bug Sending an 'abort' signal to the `createChatCompletion` does not raise an error nor stop the completion. It makes me believe that this discussion on the openai community is true https://community.openai.com/t/cancelling-openai-apis-request/99754, but I would like to verify it isn't a bug in this library. To Reproduce Here's my code [code block] Expectation: I should see output like this, and then an error should be raised: [code block] Actual: I see output like this that never stops: [code block] Code snippets _No response_ OS macOS Node version v19.8.1 Library version openai v3.2.1

Error Output

error nor stop the completion. 

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: createChatCompletion seems to ignore the abort signal

Low Risk

I have tried both `cancelToken` and `signal: abortController` neither stop the completion. Especially frustrating when the bot goes into a loop repeating the same line. By the way, I tried using frequency and presence penalty, but I think those penalty scores cause the bot to compensate with incorrect substitute tokens in things like long JSON responses.

84

Trust Score

1 verification

100% success
  1. 1

    I have tried both `cancelToken` and `signal: abortController` neither stop the c

    Especially frustrating when the bot goes into a loop repeating the same line.

  2. 2

    By the way, I tried using frequency and presence penalty, but I think those pena

    By the way, I tried using frequency and presence penalty, but I think those penalty scores cause the bot to compensate with incorrect substitute tokens in things like long JSON responses.

Validation

Resolved in openai/openai-node GitHub issue #134. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

openaigptllmapibugfixed-in-v4