caolan / caolan/async

async.series silently cancels when callback(false) is used

Open
#2,035 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
28.1k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**Description**
When using async.series with callback(false) in a task function, the series is silently canceled without running the final callback. This behavior is unexpected and undocumented, as standard error handling in async.js should still invoke the final callback when an error occurs.

**Code to Reproduce**
```
const async = require('async');

async.series([
callback => {
console.log(1);
callback(false);
},
callback => {
console.log(2);
callback();
}], () => console.log(3)
);
```

**Expected Behavior**
When callback(false) is called in a task function:

Remaining task functions should be skipped (which happens correctly)
The final callback should still be executed with the error value (which doesn't happen)

OR

Should be treated like null and continue to the next task

Expected output: 1 3 or 1 2 3

**Actual Behavior**
Only 1 is printed. The final callback is never invoked and the series is silently canceled.

**Version Information**

async.js version: async@3.2.6
Node.js version: v18.20.4
Platform: macOS - 15.3.2 - 24D81

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.