{"record":{"id":"2cedca0b484ed260","repo":"MassTransit/MassTransit","slug":"endpoint-definition-not-found-typecache-t-shortname","errorCode":null,"errorMessage":"Endpoint definition not found: {TypeCache<T>.ShortName}","messagePattern":"Endpoint definition not found: (.+?)","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/MassTransit/DependencyInjection/DependencyInjection/Registration/Endpoints/EndpointRegistration.cs","lineNumber":31,"sourceCode":"\n        public EndpointRegistration(IRegistration registration, IContainerSelector selector)\n        {\n            _registration = registration;\n            _selector = selector;\n        }\n\n        public Type Type => typeof(T);\n\n        public bool IncludeInConfigureEndpoints\n        {\n            get => _registration.IncludeInConfigureEndpoints;\n            set { }\n        }\n\n        public IEndpointDefinition GetDefinition(IServiceProvider provider)\n        {\n            return _selector.GetEndpointDefinition<T>(provider)\n                ?? throw new ConfigurationException($\"Endpoint definition not found: {TypeCache<T>.ShortName}\");\n        }\n    }\n}\n","sourceCodeStart":13,"sourceCodeEnd":35,"githubUrl":"https://github.com/MassTransit/MassTransit/blob/62ab339afa3bac2e9b3fe1769d0d35d7e44778e9/src/MassTransit/DependencyInjection/DependencyInjection/Registration/Endpoints/EndpointRegistration.cs#L13-L35","documentation":"EndpointRegistration.GetDefinition resolves the IEndpointDefinition for a registered type through a selector. When no endpoint definition has been registered for that type, MassTransit throws ConfigurationException naming the type. ConfigureEndpoints relies on this lookup, so a missing definition means the type cannot be mapped to a receive endpoint.","triggerScenarios":"Calling GetDefinition (directly or via ConfigureEndpoints) for a type T for which no EndpointDefinition was registered/associated — the selector returns null.","commonSituations":"Using ConfigureEndpoints without defining an endpoint definition for the consumer/saga; forgetting to register a custom EndpointDefinition class in the container; generic type parameter mismatch so the definition exists for a different closed type.","solutions":["Add an endpoint definition for the type, e.g. class OrderConsumerDefinition : ConsumerDefinition<OrderConsumer>, and register it (x.AddConsumer<OrderConsumer, OrderConsumerDefinition>() or via container registration).","Verify ConfigureEndpoints is called with the registration context and that the definition type's generic parameter matches the consumer/saga exactly.","If no definition is intended, disable ConfigureEndpoints for that type or configure its endpoint explicitly."],"exampleFix":"// before\nx.AddConsumer<OrderConsumer>(); // no definition registered\n\n// after\npublic class OrderConsumerDefinition : ConsumerDefinition<OrderConsumer>\n{\n    public OrderConsumerDefinition() { EndpointName = \"order-service\"; }\n}\n\nx.AddConsumer<OrderConsumer, OrderConsumerDefinition>();","handlingStrategy":"validation","validationCode":"// Ensure a definition type exists and is registered before ConfigureEndpoints\nif (!typeof(IEndpointDefinition).IsAssignableFrom(typeof(OrderConsumerDefinition)))\n    throw new InvalidOperationException(\"Register an endpoint definition for this consumer.\");","typeGuard":null,"tryCatchPattern":"try { var def = registration.GetDefinition(provider); }\ncatch (ConfigurationException ex) { logger.LogError(ex, \"Missing endpoint definition\"); }","preventionTips":["Pair every AddConsumer/AddSaga with its *Definition class when customizing endpoints.","Verify generic parameters on definition classes match the consumer/saga exactly.","Run a smoke test that calls ConfigureEndpoints in CI to catch missing definitions early."],"tags":["masstransit","configuration","endpoint-definition","dependency-injection"],"backgroundTag":"resource-not-found","analyzedSha":"62ab339afa3bac2e9b3fe1769d0d35d7e44778e9","analyzedAt":"2026-09-13T22:47:47.593Z","contentChangedAt":"2026-09-13T22:47:47.593Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}