Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(providers): parse sample before persisting; rescue user file only
[._.]/ Adam Eivy306a4f18f404
diff --git a/server/lib/aiToolkit/providers.js b/server/lib/aiToolkit/providers.jsindex 7ab12dac35..2120102fd5 100644--- a/server/lib/aiToolkit/providers.js+++ b/server/lib/aiToolkit/providers.js@@ -69,8 +69,19 @@ export function createProviderService(config = {}) {if (!existsSync(PROVIDERS_PATH)) {if (sampleFile && existsSync(sampleFile)) {const sample = await readFile(sampleFile, 'utf-8');+ // Parse BEFORE persisting — if the shipped sample is malformed we+ // don't want to seed user-side providers.json with garbage, and+ // parseOrRescue's rename target must be the user file, not the+ // shared sample (which would silently move it aside on every boot).+ let parsed;+ try {+ parsed = JSON.parse(sample);+ } catch (err) {+ console.error(`❌ sample providers file ${sampleFile} parse failed (${err.message}); starting from empty`);+ return { activeProvider: null, providers: {} };+ }await atomicWrite(PROVIDERS_PATH, sample);- return await parseOrRescue(sample, sampleFile);+ return parsed;}return { activeProvider: null, providers: {} };}