Skip to content

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

Open
@eliottkespi

Description

@eliottkespi

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: [email protected]
Node.js version: v18.20.4
Platform: macOS - 15.3.2 - 24D81

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions