{"record":{"id":"cca2d4822aa21f43","repo":"microsoft/aspire","slug":"could-not-determine-an-appropriate-location-for-local","errorCode":null,"errorMessage":"Could not determine an appropriate location for local storage. Set the AspireStorePathKeyName setting to a folder where the App Host content should be stored.","messagePattern":"Could not determine an appropriate location for local storage\\. Set the AspireStorePathKeyName setting to a folder where the App Host content should be stored\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Aspire.Hosting/DistributedApplicationBuilder.cs","lineNumber":442,"sourceCode":"        _innerBuilder.Services.AddSingleton<LocaleOverrideContext>();\n        _innerBuilder.Services.AddHealthChecks();\n        _innerBuilder.Services.AddHttpClient();\n        // Add the manifest publishing step to the pipeline\n        Pipeline.AddManifestPublishing();\n        _innerBuilder.Services.Configure<ResourceNotificationServiceOptions>(o =>\n        {\n            // Default to stopping on dependency failure if the dashboard is disabled. As there's no way to see or easily recover\n            // from a failure in that case.\n            o.DefaultWaitBehavior = options.DisableDashboard ? WaitBehavior.StopOnResourceUnavailable : WaitBehavior.WaitOnResourceUnavailable;\n        });\n        _innerBuilder.Services.AddSingleton<IAspireStore, AspireStore>(sp =>\n        {\n            var configuration = sp.GetRequiredService<IConfiguration>();\n            var aspireDir = configuration[AspireStore.AspireStorePathKeyName];\n\n            if (string.IsNullOrWhiteSpace(aspireDir))\n            {\n                throw new InvalidOperationException($\"Could not determine an appropriate location for local storage. Set the {AspireStore.AspireStorePathKeyName} setting to a folder where the App Host content should be stored.\");\n            }\n\n            var directoryService = sp.GetRequiredService<IFileSystemService>();\n            return new AspireStore(Path.Combine(aspireDir, \".aspire\"), directoryService);\n        });\n#pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.\n        _innerBuilder.Services.AddSingleton<IDeveloperCertificateService, DeveloperCertificateService>();\n#pragma warning restore ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.\n\n        // Shared DCP things (even though DCP isn't used in 'publish' and 'inspect' mode\n        // we still honour the DCP options around container runtime selection.\n        _innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<DcpOptions>, ConfigureDefaultDcpOptions>());\n        _innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<DcpOptions>, ValidateDcpOptions>());\n\n        // Aspire CLI support\n        _innerBuilder.Services.AddHostedService<CliOrphanDetector>();\n        _innerBuilder.Services.AddSingleton<BackchannelService>();\n        _innerBuilder.Services.AddHostedService<BackchannelService>(sp => sp.GetRequiredService<BackchannelService>());","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/DistributedApplicationBuilder.cs#L424-L460","documentation":"AspireStore requires a local folder to persist AppHost content (state, caches, artifacts). It resolves the root from configuration key AspireStore.AspireStorePathKeyName; when that setting is missing or blank, the builder cannot determine where to store data and throws InvalidOperationException during service provider construction.","triggerScenarios":"The configuration entry for the Aspire store path (e.g. env var ASPIRE_STORE_PATH style key) is unset or whitespace when DistributedApplicationBuilder's services are built, typically in non-standard hosting environments or stripped-down test hosts.","commonSituations":"Running the AppHost in CI containers or minimal images where the default user-profile/.aspire location can't be derived; custom hosts that don't propagate the store path configuration; HOME not set on Linux so the default path resolution fails.","solutions":["Set the AspireStore path configuration key (AspireStore.AspireStorePathKeyName) to a writable folder, e.g. via environment variable or builder.Configuration.","Ensure HOME/USERPROFILE is set so default path resolution can succeed.","If running in a container/CI, mount or point the store at a persistent writable directory like /tmp or a workspace volume."],"exampleFix":"// before: no store path configured\nvar builder = DistributedApplication.CreateBuilder(args);\n// after\nvar builder = DistributedApplication.CreateBuilder(args);\nbuilder.Configuration[\"AspireStore:Path\"] = \"/workdir/.aspire\";","handlingStrategy":"validation","validationCode":"var storePath = builder.Configuration[AspireStore.AspireStorePathKeyName];\nif (string.IsNullOrWhiteSpace(storePath) || !Directory.Exists(storePath))\n    builder.Configuration[AspireStore.AspireStorePathKeyName] = Path.GetTempPath();","typeGuard":null,"tryCatchPattern":"try { var app = builder.Build(); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"local storage\")) { /* set the store path config key and retry */ }","preventionTips":["Set the Aspire store path explicitly in CI/containers where HOME may be unset.","Verify the configured path exists and is writable before building the app.","Mount a persistent volume for the store in containerized environments."],"tags":["configuration","storage","startup"],"backgroundTag":"missing-required-config-field","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}