Skip to content

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

fix: surface the spawn-error cause when the MTPLX cache query fails

Adam Eivyc711fe9362de
diff --git a/server/lib/mtplxModels.js b/server/lib/mtplxModels.js
index 466f0605fe..581b00e0a6 100644
--- a/server/lib/mtplxModels.js
+++ b/server/lib/mtplxModels.js
@@ -47,7 +47,10 @@ export async function listMtplxCachedModels({ command = 'mtplx' } = {}) {
const result = await bufferedSpawn(binary, ['models', '--json'], { timeoutMs: CACHE_QUERY_TIMEOUT_MS, shell: false });
if (result.timedOut) return { models: null, error: `\`${command} models\` timed out` };
if (!result.success) {
- const detail = String(result.stderr || result.stdout || '').trim().split(/\r?\n/).pop();
+ // A spawn failure (EACCES, ENOENT on a dangling symlink) reports nothing on
+ // either stream — its reason lives on `error`, and dropping it would leave
+ // the user with a bare exit code for a fixable permissions problem.
+ const detail = result.error?.message || String(result.stderr || result.stdout || '').trim().split(/\r?\n/).pop();
return { models: null, error: detail || `\`${command} models\` exited with code ${result.code}` };
}
diff --git a/server/lib/mtplxModels.test.js b/server/lib/mtplxModels.test.js
index 4388896b9a..f7fee6601d 100644
--- a/server/lib/mtplxModels.test.js
+++ b/server/lib/mtplxModels.test.js
@@ -49,6 +49,10 @@ describe('listMtplxCachedModels', () => {
spawned.bufferedSpawn.mockResolvedValue({ success: false, code: -1, stdout: '', stderr: '', timedOut: true });
expect(await listMtplxCachedModels()).toMatchObject({ models: null, error: expect.stringMatching(/timed out/) });
+ // A spawn failure writes to neither stream — its reason is on `error`.
+ spawned.bufferedSpawn.mockResolvedValue({ success: false, code: -1, stdout: '', stderr: '', timedOut: false, error: new Error('spawn EACCES') });
+ expect(await listMtplxCachedModels()).toMatchObject({ models: null, error: 'spawn EACCES' });
+
spawned.bufferedSpawn.mockResolvedValue(ok('not json at all'));
expect(await listMtplxCachedModels()).toMatchObject({ models: null, error: expect.stringMatching(/did not return a model list/) });
});