Skip to content

child_process: confusing error message from functions with empty string argument #19235

@vsemozhetbyt

Description

@vsemozhetbyt
  • Version: master (10.0.0)
  • Platform: Windows 7 x64
  • Subsystem: child_process

All these function calls produce a bit confusing error message:

child_process.execFile('');
child_process.exec('');
child_process.spawn('');

child_process.execFileSync('');
child_process.execSync('');
child_process.spawnSync('');
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type string
    at normalizeSpawnArguments (child_process.js:389:11)
    ...

Compare with previous versions:

v4–v6: TypeError: Bad argument
v8–v9: TypeError: "file" argument must be a non-empty string

See

node/lib/child_process.js

Lines 388 to 389 in 74ff743

if (typeof file !== 'string' || file.length === 0)
throw new ERR_INVALID_ARG_TYPE('file', 'string', file);

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.errorsIssues and PRs related to JavaScript errors originated in Node.js core.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions