decolua/9router · error · Error
MITM server is not running. Start the server first.
Error message
MITM server is not running. Start the server first.
What it means
enableToolDNS in src/mitm/manager.js refuses to modify /etc/hosts DNS entries when the MITM proxy server process is not currently running. DNS redirection for a tool only makes sense while the proxy is live, so this is an explicit state precondition check via getMitmStatus().status.running. It prevents silently adding host entries that route traffic nowhere.
Source
Thrown at src/mitm/manager.js:825
if (e) log(`[reg] Failed to unset NODE_EXTRA_CA_CERTS: ${e.message}`);
else log(`[reg] NODE_EXTRA_CA_CERTS unset`);
});
}
try { fs.unlinkSync(PID_FILE); } catch { /* ignore */ }
try { fs.unlinkSync(LOCK_FILE); } catch { /* ignore */ }
await saveMitmSettings(false, null);
mitmIsRestarting = false;
return { running: false, pid: null };
}
/**
* Enable DNS for a specific tool (requires server running)
*/
async function enableToolDNS(tool, sudoPassword) {
const status = await getMitmStatus();
if (!status.running) throw new Error("MITM server is not running. Start the server first.");
const password = sudoPassword || getCachedPassword() || await loadEncryptedPassword();
await addDNSEntry(tool, password);
await saveDnsToolState(tool, true);
return { success: true };
}
/**
* Disable DNS for a specific tool
*/
async function disableToolDNS(tool, sudoPassword) {
const password = sudoPassword || getCachedPassword() || await loadEncryptedPassword();
await removeDNSEntry(tool, password);
await saveDnsToolState(tool, false);
return { success: true };
}
/**View on GitHub (pinned to 90b52e06ff)
Solutions
- Start the MITM server first (await startServer() or the UI equivalent) and confirm getMitmStatus().running === true
- Re-check status after starting, since startup is async — await it before enabling DNS
- If the server crashed, restart it and check logs in MITM_DIR before retrying
- If DNS entries should persist regardless, add the /etc/hosts entry manually and let the server pick it up on start
Example fix
// before
await enableToolDNS("claude", password);
// after
const status = await getMitmStatus();
if (!status.running) await startServer({ sudoPassword: password });
await enableToolDNS("claude", password); Defensive patterns
Strategy: validation
Validate before calling
const status = await getMitmStatus();
if (!status.running) await startServer({ sudoPassword });
await enableToolDNS(tool, sudoPassword); Type guard
function isMitmRunning(s) { return Boolean(s && s.running === true); } Try / catch
try {
await enableToolDNS(tool, sudoPassword);
} catch (err) {
if (err.message.includes("MITM server is not running")) {
await startServer({ sudoPassword });
await enableToolDNS(tool, sudoPassword);
} else throw err;
} Prevention
- Always check getMitmStatus().running before any manager call that requires the server
- Await server startup fully before issuing DNS/cert operations
- Expose a single 'ensureRunning()' helper in app code and use it everywhere
- Watch for server crashes and surface status in the UI before users toggle DNS
When it happens
Trigger: Calling enableToolDNS(tool, sudoPassword) (or its exported wrapper) before startServer() has completed, after the server was stopped, or after it crashed/exited.
Common situations: App freshly launched where the user toggles DNS for a tool without starting the MITM server; server died on a prior run leaving stale tool state; calling the manager API programmatically from a script without the start step.
Related errors
- MITM server is already running
- Passthrough error: ${e.message}
- Machine ID is required for Cursor API
- http2 module not available
- HTTP/2 is required for Cursor AgentService (endpoint is h2-o
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/c67c457ca5e2ccb5.
Report an issue: GitHub.