different-ai/openwork · error
app.error_connect_first
app.error_connect_first
Error message
t("app.error_connect_first") What it means
After preconditions pass, the handler calls reloadWorkspaceEngineFromUi(); a falsy return means the workspace engine could not be reloaded, typically because the app is not connected to the OpenWork/opencode server. The UI then throws this localized 'connect first' error rather than proceeding silently disconnected.
Source
Thrown at apps/app/src/react-app/shell/session-route.tsx:654
pid: openworkServerHostInfoState?.pid ?? null,
port: openworkServerHostInfoState?.port ?? null,
}),
[client?.baseUrl, openworkServerHostInfoState?.pid, openworkServerHostInfoState?.port],
);
const handleApplyEnvironmentChanges = useCallback(async () => {
if (!isDesktopRuntime()) {
throw new Error(t("settings.environment.apply_unavailable"));
}
if (activeReloadBlockingSessions.length > 0) {
throw new Error(t("settings.environment.apply_blocked_active_tasks"));
}
if (!selectedWorkspaceRoot) {
throw new Error(t("settings.environment.apply_no_local_workspace"));
}
const reloaded = await reloadWorkspaceEngineFromUi();
if (!reloaded) {
throw new Error(t("app.error_connect_first"));
}
}, [activeReloadBlockingSessions.length, reloadWorkspaceEngineFromUi, selectedWorkspaceRoot]);
const shareWorkspaceState = useShareWorkspaceState({
workspaces,
openworkServerHostInfo: openworkServerHostInfoState,
openworkServerSettings,
engineInfo: routeEngineInfo,
exportWorkspaceBusy: false,
openLink: (url) => platform.openLink(url),
workspaceLabel,
});
const remoteWorkspaceConnectionEditor = useRemoteWorkspaceConnectionEditor({
workspaces,
client,
onSaved: handleRemoteWorkspaceConnectionSaved,View on GitHub (pinned to 2b7df46e8a)
Solutions
- Reconnect the server (Account/Settings → reconnect, or restart the desktop app)
- Check that the local openwork-server process is running and the port matches the saved config
- Retry the environment apply after the connection indicator shows connected
Defensive patterns
Strategy: validation
Validate before calling
const connected = await checkServerConnection();
if (!connected) {
notify("Reconnect the OpenWork server before applying changes.");
return;
}
await handleApplyEnvironmentChanges(); Try / catch
try {
await handleApplyEnvironmentChanges();
} catch (e) {
if (String(e.message).includes("error_connect_first")) {
await reconnectServer();
await handleApplyEnvironmentChanges();
}
} Prevention
- Surface server connection status near the Apply button
- Auto-reconnect with backoff before allowing settings mutations
- Monitor the openwork-server process health
When it happens
Trigger: Clicking 'Apply' in Environment settings while reloadWorkspaceEngineFromUi() resolves false — the server/engine client is disconnected, crashed, or not yet started.
Common situations: The local openwork-server process exited; user restarted the app offline; connection was lost mid-session (server crashed or port changed); applying env vars right after startup before the engine connects.
Related errors
- OpenWork server unavailable.
- settings.environment.apply_blocked_active_tasks
- settings.environment.apply_no_local_workspace
- OpenWork server is unavailable. Reconnect the server before
- Workspace runtime is not connected.
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/c13fda82cf8567ac.
Report an issue: GitHub.