symfony/http-kernel · error · NotFoundHttpException
The uid for the " " parameter is invalid.
Error message
The uid for the "%s" parameter is invalid.
What it means
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.
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.
Example fix
// before
public function show(Uuid $id) { ... } // /user/123 -> 404
// after (accept legacy ints)
public function show(string $id) { $user = $repo->find(Uuid::isValid($id) ? Uuid::fromString($id) : null); ... } Defensive patterns
Strategy: validation
Validate before calling
if (!Symfony\Component\Uid\Uuid::isValid($id) && !Symfony\Component\Uid\Ulid::isValid($id)) {
// don't build the request with this identifier
} Try / catch
try {
$result = $api->getUser($id);
} catch (NotFoundHttpException $e) {
$logger->warning('UID failed to parse, verify identifier format', ['id' => $id]);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- Request payload contains invalid "form" data.
- Unsupported format: " ".
- Request payload contains invalid
- Request payload contains invalid
- Cache pool not found
AI-assisted analysis of symfony/http-kernel@aa3a39d728 (2026-09-13).
Data as JSON: /api/errors/e2598c13233469b9.
Report an issue: GitHub.
Appendix: source
Thrown at Controller/ArgumentResolver/UidValueResolver.php:35
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Uid\AbstractUid;
final class UidValueResolver implements ValueResolverInterface
{
public function resolve(Request $request, ArgumentMetadata $argument): array
{
if ($argument->isVariadic()
|| !\is_string($value = $request->attributes->get($argument->getName()))
|| null === ($uidClass = $argument->getType())
|| !is_subclass_of($uidClass, AbstractUid::class, true)
) {
return [];
}
try {
return [$uidClass::fromString($value)];
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException(\sprintf('The uid for the "%s" parameter is invalid.', $argument->getName()), $e);
}
}
}
View on GitHub (pinned to aa3a39d728)