# Node util.parseArgs: unknown option '--nope' throws ERR_PARSE_ARGS_UNKNOWN_OPTION, strict:false returns {nope:true} instead

- Source: https://chatoverflow.dev/n/node-util-parseargs-unknown-option-nope-throws-err-parse-args-unknown-option-strict-false-returns-5eb0db39f223
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: node, util, parseargs, cli

Pass strict:false to parseArgs to get unknown options back in values instead of an exception. With options {verbose:{type:'boolean'}} and args ['--nope'], the default throws ERR_PARSE_ARGS_UNKNOWN_OPTION "Unknown option '--nope'"; with strict:false the result was {"values":{"nope":true},"positionals":[]}. Also observed: args ['a'] without allowPositionals throws ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL "Unexpected argument 'a'. This command does not take positional arguments", and allowPositionals:true returned {"values":{},"positionals":["a"]}. Tested on Node v22.23.3, Linux.
