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: explain MTPLX runtime bootstrap failures (#5575)
[._.]/ Adam Eivy80d11dfbf167
diff --git a/server/services/mtplxServerManager.js b/server/services/mtplxServerManager.jsindex 80e79e38ba..b658fc3bec 100644--- a/server/services/mtplxServerManager.js+++ b/server/services/mtplxServerManager.js@@ -115,6 +115,13 @@ export const MTPLX_UNSUPPORTED_REASON = 'MTPLX runs only on macOS with Apple Sil*/const MTPLX_NO_MODEL_ERROR = 'MTPLX has no model weights cached, so its server exits before it binds a port. Use "Download default checkpoint" on the MTPLX card (or search for another MTP model there) to fetch one — a multi-gigabyte download PortOS will not start without you asking — then start MTPLX again.';+const MTPLX_RUNTIME_BOOTSTRAP_ERROR = 'MTPLX\'s own Python runtime failed to bootstrap because Homebrew\'s Python does not provide a working `ensurepip`. Try `brew reinstall [email protected]` (or `brew install youssofal/mtplx/mtplx --build-from-source` to force a rebuild against a working interpreter), then start MTPLX again.';++const isMtplxRuntimeBootstrapFailure = (output) => {+ const text = String(output ?? '');+ return /runtime is not installed|bootstrapping with pip/i.test(text) && /ensurepip/i.test(text);+};+let currentConfig = null;let lastExitError = null;@@ -476,13 +483,16 @@ export async function startMtplxServer(options = {}) {const lines = `${pm2Logs?.stderr || pm2Logs?.stdout || ''}`.split('\n').map((l) => l.trimEnd()).filter(Boolean);for (const line of lines) appendLog(line);const tail = (lines.length ? lines : daemon.snapshotLogs()).slice(-4).join(' | ');-lastExitError = `PM2 status: ${currentProc.status}`;+ const message = isMtplxRuntimeBootstrapFailure(lines.join('\n'))+ ? MTPLX_RUNTIME_BOOTSTRAP_ERROR+ : `MTPLX exited immediately (${lastExitError}).${tail ? ` Last output: ${tail}` : ''}`;+await execPm2(['delete', MTPLX_APP]).catch(() => {});clearJlistCache();currentConfig = null;throw new ServerError(- `MTPLX exited immediately (${lastExitError}).${tail ? ` Last output: ${tail}` : ''}`,+ message,{ status: 500, code: 'MTPLX_EXITED' });}diff --git a/server/services/mtplxServerManager.test.js b/server/services/mtplxServerManager.test.jsindex 8a517a976e..5366a9c378 100644--- a/server/services/mtplxServerManager.test.js+++ b/server/services/mtplxServerManager.test.js@@ -210,6 +210,36 @@ describe('mtplxServerManager', () => {expect(pm2State).toBeNull();});+ it('explains how to recover when MTPLX cannot bootstrap its Python runtime', async () => {+ vi.spyOn(pm2Module, 'execPm2').mockImplementation(async (args) => {+ execPm2Calls.push(args);+ if (args[0] === 'start') {+ pm2State = { name: MTPLX_APP, status: 'errored', pid: null, args: [] };+ }+ if (args[0] === 'delete') pm2State = null;+ if (args[0] === 'logs') {+ return {+ stdout: '',+ stderr: [+ 'runtime is not installed',+ 'Bootstrapping with pip',+ 'python3.13 -m ensurepip --upgrade --default-pip',+ "Command '['python3.13', '-m', 'ensurepip']' returned non-zero exit status 1",+ ].join('\n'),+ };+ }+ return { stdout: '', stderr: '' };+ });++ const err = await startMtplxServer().catch((error) => error);++ expect(err).toMatchObject({ code: 'MTPLX_EXITED' });+ expect(err.message).toContain('Homebrew\'s Python does not provide a working `ensurepip`');+ expect(err.message).toContain('brew reinstall [email protected]');+ expect(err.message).not.toContain('returned non-zero exit status 1');+ expect(pm2State).toBeNull();+ });+it('reports the endpoint it actually bound, with no host it never passes', async () => {// MTPLX is a loopback daemon and no `--host` ever reaches its launch line,// so accepting a host would record an endpoint the server is not bound to.