{"record":{"id":"e2598c13233469b9","repo":"symfony/http-kernel","slug":"the-uid-for-the-s-parameter-is-invalid","errorCode":null,"errorMessage":"The uid for the \"%s\" parameter is invalid.","messagePattern":"The uid for the \"(.+?)\" parameter is invalid\\.","errorType":"http","errorClass":"NotFoundHttpException","httpStatus":404,"severity":"error","filePath":"Controller/ArgumentResolver/UidValueResolver.php","lineNumber":35,"sourceCode":"use Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\nuse Symfony\\Component\\Uid\\AbstractUid;\n\nfinal class UidValueResolver implements ValueResolverInterface\n{\n    public function resolve(Request $request, ArgumentMetadata $argument): array\n    {\n        if ($argument->isVariadic()\n            || !\\is_string($value = $request->attributes->get($argument->getName()))\n            || null === ($uidClass = $argument->getType())\n            || !is_subclass_of($uidClass, AbstractUid::class, true)\n        ) {\n            return [];\n        }\n\n        try {\n            return [$uidClass::fromString($value)];\n        } catch (\\InvalidArgumentException $e) {\n            throw new NotFoundHttpException(\\sprintf('The uid for the \"%s\" parameter is invalid.', $argument->getName()), $e);\n        }\n    }\n}\n","sourceCodeStart":17,"sourceCodeEnd":39,"githubUrl":"https://github.com/symfony/http-kernel/blob/aa3a39d7286a62cdfea98f0e69c651a3da6e36cf/Controller/ArgumentResolver/UidValueResolver.php#L17-L39","documentation":"The UidValueResolver maps controller arguments typed as a ULID/UUID to objects by parsing the route parameter with Uuid::fromString()/Ulid::fromString(). If the string is not a valid UID representation, the InvalidArgumentException is wrapped in a 404 NotFoundHttpException. Symfony treats an unparseable UID in the URL as a resource-not-found rather than a 400.","triggerScenarios":"A route like /user/{id} with a controller signature User $id typed as Uuid (or Ulid) receives a value that isn't a valid UUID/ULID - e.g. /user/123, /user/abc, or a truncated identifier.","commonSituations":"Clients storing malformed IDs; hand-typed URLs in tests/browsers; mixing UUID versions (v4 vs v7 object types in the signature); legacy integer IDs still circulating after a migration to UUIDs.","solutions":["Check the URL the client used and send a valid, correctly formatted ULID/UUID string.","Ensure you generate IDs with the matching library (Symfony Uuid/Ulid factories) and the same type as the controller signature (Uuid vs Ulid).","If legacy numeric IDs must work, change the argument type to string or int and resolve manually.","Add client-side format validation (regex for UUID v4/ULID) before constructing links."],"exampleFix":"// before\npublic function show(Uuid $id) { ... } // /user/123 -> 404\n// after (accept legacy ints)\npublic function show(string $id) { $user = $repo->find(Uuid::isValid($id) ? Uuid::fromString($id) : null); ... }","handlingStrategy":"validation","validationCode":"if (!Symfony\\Component\\Uid\\Uuid::isValid($id) && !Symfony\\Component\\Uid\\Ulid::isValid($id)) {\n    // don't build the request with this identifier\n}","typeGuard":null,"tryCatchPattern":"try {\n    $result = $api->getUser($id);\n} catch (NotFoundHttpException $e) {\n    $logger->warning('UID failed to parse, verify identifier format', ['id' => $id]);\n}","preventionTips":["Validate UUID/ULID format client-side before building links or API calls.","Use matching types (Uuid vs Ulid) between storage, generation, and controller signatures.","Migrate or map legacy integer IDs explicitly instead of passing them to UID-typed routes."],"tags":["symfony","http-kernel","uid","uuid","not-found"],"backgroundTag":"invalid-identifier-format","analyzedSha":"aa3a39d7286a62cdfea98f0e69c651a3da6e36cf","analyzedAt":"2026-09-13T18:03:36.509Z","contentChangedAt":"2026-09-13T18:03:36.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}