{"id":"c4b2403bcdea6ed2","repo":"nestjs/nest","slug":"validation-failed-c4b240","errorCode":null,"errorMessage":"Validation failed","messagePattern":"Validation failed","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"sample/10-fastify/src/common/pipes/parse-int.pipe.ts","lineNumber":9,"sourceCode":"import { BadRequestException } from '@nestjs/common';\nimport { PipeTransform, Injectable, ArgumentMetadata } from '@nestjs/common';\n\n@Injectable()\nexport class ParseIntPipe implements PipeTransform<string> {\n  async transform(value: string, metadata: ArgumentMetadata) {\n    const val = parseInt(value, 10);\n    if (isNaN(val)) {\n      throw new BadRequestException('Validation failed');\n    }\n    return val;\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":14,"githubUrl":"https://github.com/nestjs/nest/blob/6ec0e2783d15290732447f304d8549b591b9749e/sample/10-fastify/src/common/pipes/parse-int.pipe.ts#L1-L14","documentation":"Error \"Validation failed\" thrown in nestjs/nest.","triggerScenarios":"Thrown at sample/10-fastify/src/common/pipes/parse-int.pipe.ts:9 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a numeric value for the :id route parameter; the parse-int pipe rejects non-numeric input.","Fix the client request URL to include an integer id.","If arbitrary string ids are allowed, drop the ParseIntPipe from the parameter."],"exampleFix":"// client: GET /cats/42\n@Get(':id')\nfindOne(@Param('id', ParseIntPipe) id: number) {}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"6ec0e2783d15290732447f304d8549b591b9749e","analyzedAt":"2026-08-03T17:42:23.673Z","schemaVersion":2}