Repository navigation
Register IEmbeddingProvider service for PostgreSqlContentIndexing dependency #1642
Description
What is failing
The MCP tool search_chunks fails at startup on both Memex portal pods because Autofac cannot resolve MeshWeaver.Hosting.Embeddings.IEmbeddingProvider when activating IChunkedContentVectorStore.
Probable cause — high confidence
The AddPostgreSqlContentIndexing extension method registers IChunkedContentVectorStore with a factory lambda that takes IEmbeddingProvider as a dependency. The Memex deployment calls AddPostgreSqlContentIndexing but does not register IEmbeddingProvider in the Autofac container — visible in the stack trace at PostgreSqlContentIndexingExtensions.<>c.<AddPostgreSqlContentIndexing>b__1_0(IServiceProvider sp). The fix is to either:
- Register a concrete
IEmbeddingProviderbefore callingAddPostgreSqlContentIndexing, or - Make
AddPostgreSqlContentIndexingself-contained by registering a default embedding provider when none is present (e.g., usingTryAddorResolveOptional).
Impact
The search_chunks MCP tool is non-functional across both deployment pods. This was hit at deployment startup (2 occurrences, one per pod, within the same second) — every invocation of the tool on either pod will produce the same failure until the registration is fixed.
Where to look
PostgreSqlContentIndexingExtensions.cs— the registration lambda atAddPostgreSqlContentIndexingthat injectsIEmbeddingProvider.- The Memex portal's
Startup/ DI configuration (whereAddPostgreSqlContentIndexingis called) — verifyIEmbeddingProvideris registered beforehand. MeshWeaver.Hosting.Embeddings.IEmbeddingProvider— the missing service interface.
Evidence
| Fingerprint | 6d40a3352d852518 |
| Category | ModelContextProtocol.Server.McpServer |
| Severity | Error |
| Exception | System.InvalidOperationException |
| Top frame | Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType) |
| Namespace | memex |
| Pods | memex-portal-deployment-f666d6c4d-4pnzt, memex-portal-deployment-79cddfb6b7-l7gvv |
| Occurrences | 2 |
| First seen | 2026-08-15 20:21:17Z |
| Last seen | 2026-08-15 20:21:17Z |
Recent log lines
2026-08-15 20:21:17Z memex-portal-deployment-f666d6c4d-4pnzt fail: ModelContextProtocol.Server.McpServer[1433779783]
"search_chunks" threw an unhandled exception.
System.InvalidOperationException: An exception was thrown while activating MeshWeaver.ContentCollections.Indexing.IChunkedContentVectorStore.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating MeshWeaver.ContentCollections.Indexing.IChunkedContentVectorStore.
---> System.InvalidOperationException: The requested service 'MeshWeaver.Hosting.Embeddings.IEmbeddingProvider' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
See https://autofac.rtfd.io/help/service-not-registered for more info.
---> Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'MeshWeaver.Hosting.Embeddings.IEmbeddingProvider' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
See https://autofac.rtfd.io/help/service-not-registered for more info.
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
--- End of inner exception stack trace ---
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at MeshWeaver.ContentCollections.Indexing.PostgreSql.PostgreSqlContentIndexingExtensions.<>c__1`1.<AddPostgreSqlContentIndexing>b__1_0(IServiceProvider sp) in /home/runner/work/MeshWeaver/MeshWeaver/src/MeshWeaver.ContentCollections.Indexing.PostgreSql/PostgreSqlContentIndexingE…[truncated]
2026-08-15 20:21:17Z memex-portal-deployment-79cddfb6b7-l7gvv fail: ModelContextProtocol.Server.McpServer[1433779783]
"search_chunks" threw an unhandled exception.
System.InvalidOperationException: An exception was thrown while activating MeshWeaver.ContentCollections.Indexing.IChunkedContentVectorStore.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating MeshWeaver.ContentCollections.Indexing.IChunkedContentVectorStore.
---> System.InvalidOperationException: The requested service 'MeshWeaver.Hosting.Embeddings.IEmbeddingProvider' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
See https://autofac.rtfd.io/help/service-not-registered for more info.
---> Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'MeshWeaver.Hosting.Embeddings.IEmbeddingProvider' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
See https://autofac.rtfd.io/help/service-not-registered for more info.
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
--- End of inner exception stack trace ---
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at MeshWeaver.ContentCollections.Indexing.PostgreSql.PostgreSqlContentIndexingExtensions.<>c__1`1.<AddPostgreSqlContentIndexing>b__1_0(IServiceProvider sp) in /home/runner/work/MeshWeaver/MeshWeaver/src/MeshWeaver.ContentCollections.Indexing.PostgreSql/PostgreSqlContentIndexingE…[truncated]
Opened automatically from Admin/_LogIncident/6d40a3352d852518. Recurrences are folded into this issue rather than opening new ones.
Activity
rbuergi commentedon Aug 25, 2026
Fixed by #2248 (
a3118e886).Correcting the record first: a claim circulated during triage tonight that
IEmbeddingProviderwas "registered nowhere" — that was wrong, and it came from a grep forAddSingleton<IEmbeddingProvider>that missed the registration living inside theAddEmbeddingsextension (src/MeshWeaver.Hosting.Embeddings/EmbeddingExtensions.cs, present since91ea0c2c1, and called from bothMemex.Portal.Distributed/Program.cs:188and the migration host). The provider is registered where embeddings are configured.What was actually wrong, and is now fixed:
The capability had no explicit signal. Consumers each re-derived "do we have embeddings?" from options, so a second copy of
CreateEmbeddingProvider's branch logic could drift and advertise a capability the host does not have. There is now an explicitEmbeddingCapability(src/MeshWeaver.Hosting.Embeddings/EmbeddingCapability.cs) — the registration itself is the signal, read once rather than re-derived.A second, independent defect found while doing it — and this is the sharper one.
PostgreSqlExtensions.cs:161,:206andSnowflakeExtensions.cs:138each calledservices.BuildServiceProvider()mid-registration to read the optional provider. That builds a second, throwaway container: anything registered after that line is invisible to it, and any singleton it resolves is a duplicate of the one every other consumer gets. So whether those adapters had embeddings depended on whether the host calledAddEmbeddingsbefore or after — with both failure modes invisible, presenting identically as a silent degrade to lexical search.Fixed by building the adapters from the real container via a new
AddPersistence(Func<IServiceProvider, IStorageAdapter>)overload. Noservices.BuildServiceProvider()remains on any registration path insrc/ormemex/.Those three lanes currently have no callers (the portals use
AddPartitionedPostgreSqlPersistence), so it was latent — but it would have quietly defeated the capability fix the moment one was used.systemorph-com commentedon Sep 17, 2026
Reopened — this fault is happening again.
Still occurring: 11 more since the last update (13 total).
memex-portal-deployment-f666d6c4d-4pnzt,memex-portal-deployment-79cddfb6b7-l7gvv,memex-portal-deployment-68795ccb45-4dpdk,memex-portal-deployment-68795ccb45-hzj6p,memex-portal-deployment-f47f8cdd-f8fmq,memex-portal-deployment-76b967b5fb-pkw5p,memex-portal-deployment-745df44fc8-gtrfd,memex-portal-deployment-745df44fc8-drjtpRecent log lines
rbuergi commentedon Sep 17, 2026
Re-closed — the reopen above was on stale evidence (#4577).
The recurrence bot reopened this at
2026-09-17T07:51:47Zunder the headline "this fault is happening again", but the occurrence its own comment cites is OLDER than the close it reverted:Last seen:2026-08-18 11:42:40Z2026-08-25T19:46:53ZSo the counter moved, not the clock — the fault's newest occurrence predates the close, which is the one thing "still happening" has to mean. Root cause and fix:
LogIncidentFiler.Reopenreopened on the sole condition that the issue was closed, while the comment-debt clock pays a final count for incidents whose fault has stopped (the fix, Systemorph/MeshWeaver.Plugins#2014, is written but NOT yet merged — it makes a reopen requireincident.LastSeen > issue.ClosedAt).This restores the close exactly as it stood; nothing is asserted about the defect itself. If the fault happens again, the next occurrence postdates this close and reopens the issue on evidence that means what it says.
One of 53 issues whose reopen was measured stale (129 bot reopens on 2026-09-17, 125 of them inside the 07:51-07:53Z sweep; 76 postdate their close and were left open). Measured and re-closed 2026-09-17 by Claude Opus 5.