vitest-dev/vitest · error · TypeError

Unexpected value "--silent=${value}". Use "--silent=true ${v

Error message

Unexpected value "--silent=${value}". Use "--silent=true ${value}" instead.

What it means

Thrown by the `--silent` option transform when the supplied value is none of the accepted set. The transform accepts true/false/yes/no (booleans) and the literal string 'passed-only' (logs from failing tests only). Any other value is ambiguous and rejected with guidance to combine `--silent=true` with the extra token.

Source

Thrown at packages/vitest/src/node/cli/cli-config.ts:135

      }
      return portOrOptions
    },
  },
  silent: {
    description: 'Silent console output from tests. Use `\'passed-only\'` to see logs from failing tests only.',
    argument: '[value]',
    transform(value) {
      if (value === 'true' || value === 'yes' || value === true) {
        return true
      }
      if (value === 'false' || value === 'no' || value === false) {
        return false
      }
      if (value === 'passed-only') {
        return value
      }

      throw new TypeError(`Unexpected value "--silent=${value}". Use "--silent=true ${value}" instead.`)
    },
  },
  hideSkippedTests: {
    description: 'Hide logs for skipped tests',
  },
  reporter: null,
  reporters: {
    alias: 'reporter',
    description: `Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,
    argument: '<name>',
    subcommands: null, // don't support custom objects
    array: true,
  },
  outputFile: {
    argument: '<filename/-s>',
    description:
      'Write test results to a file when supporter reporter is also specified, use cac\'s dot notation for individual outputs of multiple reporters (example: `--outputFile.tap=./tap.txt`)',
    subcommands: null,

View on GitHub (pinned to d568f8ce37)

Solutions

  1. Use one of: `--silent`, `--silent=true`/`--silent=false`/`--silent=yes`/`--silent=no`, or `--silent=passed-only`.
  2. If the unexpected value is a separate CLI token, separate it: `--silent=true <value>` instead of `--silent=<value>`.
  3. Check the flag name spelling and remove trailing tokens merged by the shell.

Example fix

# before
vitest --silent=quiet
# after
vitest --silent=true
Defensive patterns

Strategy: validation

Validate before calling

const ok = ['true', 'false', 'yes', 'no', 'passed-only', true, false]
if (!ok.includes(value)) {
  throw new Error(`invalid --silent value: ${value}`)
}

Type guard

function isSilentValue(v: unknown): v is boolean | 'passed-only' {
  return [true, false, 'true', 'false', 'yes', 'no', 'passed-only'].includes(v as any)
}

Prevention

When it happens

Trigger: Passing `--silent=quiet`, `--silent=verbose`, `--silent=0/1` (other than the accepted words), or any unrecognized string to `--silent`. The error message itself hints that the user likely meant `--silent=true <value>` where `<value>` was accidentally attached to the flag.

Common situations: Confusing `--silent` with a verbosity selector; typos; copying a value from another tool's flag; passing a reporter/filter token that got merged onto --silent by shell quoting.


AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03). Data as JSON: /data/errors/b05a3ec9cf81a51b.json. Report an issue: GitHub.