{"record":{"id":"d4ee119c89454640","repo":"pnpm/pnpm","slug":"bad-outdated-format","errorCode":"BAD_OUTDATED_FORMAT","errorMessage":"Unsupported format: ${opts.format?.toString() ?? 'undefined'}","messagePattern":"Unsupported format: (.+?)","errorType":"exception","errorClass":"PnpmError","httpStatus":null,"severity":"error","filePath":"pnpm11/deps/inspection/commands/src/outdated/outdated.ts","lineNumber":266,"sourceCode":"    ...outdatedActions.map(toOutdatedAction),\n  ]\n\n  let output!: string\n  switch (opts.format ?? 'table') {\n    case 'table': {\n      output = renderOutdatedTable(outdatedPackages, opts)\n      break\n    }\n    case 'list': {\n      output = renderOutdatedList(outdatedPackages, opts)\n      break\n    }\n    case 'json': {\n      output = renderOutdatedJSON(outdatedPackages, opts)\n      break\n    }\n    default: {\n      throw new PnpmError('BAD_OUTDATED_FORMAT', `Unsupported format: ${opts.format?.toString() ?? 'undefined'}`)\n    }\n  }\n  return {\n    output,\n    exitCode: outdatedPackages.length === 0 ? 0 : 1,\n  }\n}\n\nexport type OutdatedItem = OutdatedPackage & { dependencyType?: 'githubAction' }\n\nfunction renderOutdatedTable (outdatedPackages: readonly OutdatedItem[], opts: { long?: boolean, sortBy?: 'name' }): string {\n  if (outdatedPackages.length === 0) return ''\n  const columnNames = [\n    'Package',\n    'Current',\n    'Latest',\n  ]\n","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/pnpm/pnpm/blob/5b11d3a15b9022a2109cb18ed96a5d652630371f/pnpm11/deps/inspection/commands/src/outdated/outdated.ts#L248-L284","documentation":"The single-project `pnpm outdated` renderer only knows three output formats — table (default), list, and json. The switch over opts.format fell through to default, meaning the value arriving (after CLI parsing and config merging) is none of those three, or undefined reached a code path that required a known format.","triggerScenarios":"`pnpm outdated --format=markdown`, `--format=yaml`, a typo like `--format=tabel`, or programmatically calling the outdated handler with a format value outside the 'table' | 'list' | 'json' union.","commonSituations":"Copy-pasting a `--format` value from another tool (npm audit uses --json, yarn has different names); assuming pnpm outdated supports the same formats as `pnpm list --format` or `pnpm audit`; config drift between pnpm versions adding/removing formats.","solutions":["Use one of: `--format=table`, `--format=list`, `--format=json`","If you need machine-readable output, `pnpm outdated --format=json` is the supported shape","Check `pnpm help outdated` for the current release's accepted values before scripting around it"],"exampleFix":"# before\npnpm outdated --format=markdown\n\n# after\npnpm outdated --format=list   # or table / json","handlingStrategy":"validation","validationCode":"const OUTDATED_FORMATS = ['table', 'list', 'json'] as const\ntype OutdatedFormat = typeof OUTDATED_FORMATS[number]\n\nfunction toOutdatedFormat (value: string | undefined, fallback: OutdatedFormat = 'table'): OutdatedFormat {\n  if (value == null) return fallback\n  if ((OUTDATED_FORMATS as readonly string[]).includes(value)) return value as OutdatedFormat\n  throw new Error(`Unsupported --format '${value}'. Use one of: ${OUTDATED_FORMATS.join(', ')}`)\n}","typeGuard":"function isOutdatedFormat (value: unknown): value is 'table' | 'list' | 'json' {\n  return value === 'table' || value === 'list' || value === 'json'\n}","tryCatchPattern":"catch (err) {\n  if (typeof err === 'object' && err !== null && (err as { code?: string }).code === 'BAD_OUTDATED_FORMAT') {\n    opts.format = 'table' // safe default\n    return runOutdated(opts)\n  }\n  throw err\n}","preventionTips":["Constrain format to a literal-union type at the option-parsing boundary","Do not pass through raw CLI strings as format values; normalize first","Parse --format=json output in CI — it is the only stable machine-readable contract"],"tags":["cli","validation","outdated","usage-error"],"backgroundTag":null,"analyzedSha":"5b11d3a15b9022a2109cb18ed96a5d652630371f","analyzedAt":"2026-08-16T13:18:59.198Z","schemaVersion":2},"datasetVersion":"2026-08-16T18:17:16.020Z"}