{"record":{"id":"44a7677979fd77a3","repo":"vitest-dev/vitest","slug":"unknown-value-for-test-listtags-listtags","errorCode":null,"errorMessage":"Unknown value for \"test.listTags\": ${listTags}","messagePattern":"Unknown value for \"test\\.listTags\": (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/core.ts","lineNumber":497,"sourceCode":"    else if (listTags === 'json') {\n      const hasTags = [this.getRootProject(), ...this.projects].some(p => p.config.tags && p.config.tags.length > 0)\n      if (!hasTags) {\n        process.exitCode = 1\n        this.logger.printNoTestTagsFound()\n      }\n      else {\n        const manifest = {\n          tags: this.config.tags,\n          projects: this.projects.filter(p => p !== this.coreWorkspaceProject).map(p => ({\n            name: p.name,\n            tags: p.config.tags,\n          })),\n        }\n        this.logger.log(JSON.stringify(manifest, null, 2))\n      }\n    }\n    else {\n      throw new Error(`Unknown value for \"test.listTags\": ${listTags}`)\n    }\n  }\n\n  public async enableCoverage(): Promise<void> {\n    this.configOverride.coverage = {} as any\n    this.configOverride.coverage!.enabled = true\n    await this.createCoverageProvider()\n    await this.coverageProvider?.onEnabled?.()\n\n    // onFileTransform is the only thing that affects hash\n    if (this.coverageProvider?.onFileTransform) {\n      this.clearAllCachePaths()\n    }\n  }\n\n  public disableCoverage(): void {\n    this.configOverride.coverage ??= {} as any\n    this.configOverride.coverage!.enabled = false","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/core.ts#L479-L515","documentation":"The `test.listTags` option accepts a strict union: a boolean (`true`/`false`) to print tags as plain text, or the literal string `'json'` to emit a machine-readable manifest. Any other value (a number, an object, an unrecognised string) reaches the final `else` branch and is rejected.","triggerScenarios":"Setting `listTags: 'yes'`, `listTags: 1`, `listTags: { format: 'json' }`, or any value that is neither boolean nor `'json'`.","commonSituations":"Treating the option as a free-form string; copy-pasting from docs that used a different spelling; env-var coercion turning 'true' into the string value 'true' instead of a boolean.","solutions":["Use `listTags: true` for the default text output or `listTags: 'json'` for JSON.","If sourcing the value from an env var, coerce explicitly: `listTags: process.env.LIST_TAGS === 'json' ? 'json' : Boolean(process.env.LIST_TAGS)`.","Leave the option unset if you do not want tag listing."],"exampleFix":"// before\nlistTags: 'true'\n// after\nlistTags: true","handlingStrategy":"type-guard","validationCode":"function normaliseListTags(v: unknown): boolean | 'json' | undefined {\n  if (v === 'json') return 'json'\n  if (typeof v === 'boolean') return v\n  throw new Error(`listTags must be boolean or 'json', received: ${String(v)}`)\n}\nconfig.test.listTags = normaliseListTags(process.env.LIST_TAGS)","typeGuard":"function isValidListTags(v: unknown): v is boolean | 'json' {\n  return v === 'json' || typeof v === 'boolean'\n}","tryCatchPattern":null,"preventionTips":["Always coerce env-var-sourced `listTags` values explicitly.","Treat the option as a closed union, not a free-form string."],"tags":["config","tags","validation","cli"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}