sinelaw/fresh · error
editor.spawnProcess is not implemented (missing…
Error message
editor.spawnProcess is not implemented (missing _spawnProcessStart)
What it means
editor.spawnProcess is a JS shim installed by the QuickJS plugin backend that delegates process spawning to a Rust-provided host function editor._spawnProcessStart. If that host binding was never injected into the editor object (backend built without the spawn capability, or an older runtime), the shim throws rather than silently returning a dead handle.
Solutions
- Upgrade/verify the fresh-plugin-runtime build so the _spawnProcessStart binding is registered before plugin code runs.
- Feature-detect before calling: if (typeof editor._spawnProcessStart !== 'function') fall back to another mechanism.
- Check whether the platform/backend in use actually supports child processes (some sandboxed targets do not).
- Guard the plugin call site so the plugin degrades gracefully instead of crashing.
Example fix
// before
const handle = editor.spawnProcess("git", ["status"]);
// after
if (typeof editor._spawnProcessStart !== "function") {
throw new Error("process spawning unsupported in this runtime");
}
const handle = editor.spawnProcess("git", ["status"]); Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof editor._spawnProcessStart !== "function") {
throw new Error("process spawning not supported in this runtime");
} Type guard
function supportsSpawn(editor) {
return typeof editor._spawnProcessStart === "function" &&
typeof editor.spawnProcess === "function";
} Try / catch
try {
handle = editor.spawnProcess(cmd, args, cwd);
} catch (e) {
if (String(e.message).includes("_spawnProcessStart")) {
// fall back: run without subprocess support
} else throw e;
} Prevention
- Feature-detect editor._spawnProcessStart before any spawn call.
- Verify the runtime/backend build includes process-spawn host bindings.
- Declare spawn capability requirements in the plugin manifest and check at startup.
- Keep the plugin runtime and editor versions in sync.
When it happens
Trigger: A plugin calls editor.spawnProcess(cmd, args, cwdOrOpts, fourth) in the QuickJS backend when editor._spawnProcessStart is not a function — i.e. the quickjs_backend.rs runtime did not register the _spawnProcessStart host binding (unsupported/older runtime, feature-disabled build).
Common situations: Plugins using process spawning against a runtime compiled without process-spawn support; running the plugin in an embedded/sandboxed QuickJS context where host bindings were partially installed; version mismatch between plugin expectations and the editor backend.
Related errors
- editor.spawnHostProcess is not implemented (missing…
- TypeScript plugin thread creation failed
- openFileInSplit: split
- previewFileInSplit: split
- Failed to spawn shell
AI-assisted analysis of sinelaw/fresh@67894ca546 (2026-09-13).
Data as JSON: /api/errors/d4e5952fa51d770f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/fresh-plugin-runtime/src/backend/quickjs_backend.rs:8603
},
catch(onRejected) {
return resultPromise.catch(onRejected);
}
};
};
};
// Apply wrappers to async functions on editor
// spawnProcess accepts either form for the 4th arg:
// editor.spawnProcess(cmd, args, cwd?, stdoutTo?: string)
// editor.spawnProcess(cmd, args, cwd?, { stdoutTo?: string })
// The first matches the auto-generated TS signature
// (flat positional from the Rust binding's `Opt<String>`
// args); the second is the structured options form
// plugin authors often prefer.
editor.spawnProcess = function(command, argsArr, cwdOrOpts, fourth) {
if (typeof editor._spawnProcessStart !== 'function') {
throw new Error('editor.spawnProcess is not implemented (missing _spawnProcessStart)');
}
// The 3rd arg is either cwd (string) or an options
// object when cwd is omitted; the 4th is either a
// stdoutTo string or an options object.
let cwd = "";
let stdoutTo = "";
if (typeof cwdOrOpts === "string") {
cwd = cwdOrOpts;
} else if (cwdOrOpts && typeof cwdOrOpts === "object") {
if (typeof cwdOrOpts.stdoutTo === "string") stdoutTo = cwdOrOpts.stdoutTo;
}
if (typeof fourth === "string") {
stdoutTo = fourth;
} else if (fourth && typeof fourth === "object") {
if (typeof fourth.stdoutTo === "string") stdoutTo = fourth.stdoutTo;
}
const callbackId = editor._spawnProcessStart(
command,View on GitHub (pinned to 67894ca546)