{"record":{"id":"9fec03c3e79a83c4","repo":"mastra-ai/mastra","slug":"source-provider-this-provider-displayname-canno","errorCode":null,"errorMessage":"Source provider ${this.provider.displayName} cannot read files","messagePattern":"Source provider (.+?) cannot read files","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/agents/source.ts","lineNumber":176,"sourceCode":"  private readonly loadedHistory = new Set<string>();\n  private readonly hydratedAgents = new Set<string>();\n  private readonly activeRefs = new Map<string, string>();\n  private providerAgentIdsDiscovered = false;\n\n  constructor({ provider, agentIds = [] }: SourceAgentsSourceControlConfig) {\n    super();\n    this.provider = provider;\n    this.knownAgentIds = new Set(agentIds);\n  }\n\n  __registerMastra(mastra: StorageMastraRef): void {\n    this.storageMastra = mastra;\n  }\n\n  override async init(): Promise<void> {\n    const capabilities = await this.provider.getCapabilities();\n    if (!capabilities.canRead) {\n      throw new Error(capabilities.reason ?? `Source provider ${this.provider.displayName} cannot read files`);\n    }\n    this.refreshKnownAgentIds();\n    await this.discoverProviderAgentIds();\n    await Promise.all([...this.knownAgentIds].map(agentId => this.hydrateAgent(agentId)));\n  }\n\n  async dangerouslyClearAll(): Promise<void> {\n    this.hydratedAgents.clear();\n    this.loadedHistory.clear();\n    this.providerVersions.clear();\n    this.activeRefs.clear();\n    this.providerAgentIdsDiscovered = false;\n    await this.memory.dangerouslyClearAll();\n  }\n\n  async useProviderRef(agentId: string, ref: string): Promise<void> {\n    this.activeRefs.set(agentId, ref);\n    this.hydratedAgents.delete(agentId);","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/agents/source.ts#L158-L194","documentation":"During MastraStorage source-domain initialization, the storage backend asks its configured source provider whether it can read files (getCapabilities). If the provider reports canRead=false, init() aborts with this error (or the provider's more specific reason text). This guards against wiring a write-only or otherwise unsuitable provider as an agent source.","triggerScenarios":"Calling init() on the agents storage source when the configured provider's getCapabilities() returns canRead=false, or when capabilities.reason is set (that reason string is thrown instead).","commonSituations":"Configuring a source provider against a read-only-forbidden location (e.g. an HTTP provider, a provider pointed at an unwritable/unsupported backend), misconfigured credentials causing the provider to report degraded capabilities, or swapping provider implementations that don't support reads.","solutions":["Inspect capabilities.reason in the error message for the provider-specific explanation and fix that underlying issue","Replace or reconfigure the source provider with one that supports reading files","Fix provider configuration (paths, credentials, scheme) so getCapabilities() reports canRead=true","If you only need writes, do not use this provider as a source; use the appropriate storage domain instead"],"exampleFix":"// before\nnew HttpSourceProvider({ url: 'https://example.com/agents' }) // canRead=false\n// after\nnew LocalFileSourceProvider({ root: './agents' }) // supports reads","handlingStrategy":"validation","validationCode":"const caps = await provider.getCapabilities();\nif (!caps.canRead) throw new Error(caps.reason ?? 'provider cannot read files');","typeGuard":"function canRead(caps: { canRead: boolean }): caps is { canRead: true } { return caps.canRead === true; }","tryCatchPattern":"try { await source.init(); } catch (e) { if (e.message.includes('cannot read files')) { /* reconfigure provider */ } throw e; }","preventionTips":["Check getCapabilities() at startup before wiring a provider","Use providers documented as read-capable for source domains","Include a custom capabilities.reason to surface actionable messages","Add a startup health check that fails fast on capability mismatch"],"tags":["storage","agents","configuration","source-provider"],"backgroundTag":"provider-capability-unsupported","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}