Skip to content

Commit e50adaf

Browse files
FelixMalfaitclaude
andauthored
feat(sdk): give Docker-not-running error an actionable next step (#20280)
## Summary The current Docker-not-running message is unhelpful in two ways: 1. It doesn't tell users **how** to start Docker 2. "try again" is meaningless because a first-time user doesn't yet know the command they just ran (they got here from `create-twenty-app`, not from typing `yarn twenty server start` themselves) **Before:** ``` Docker is not running. Please start Docker and try again. ``` **After (macOS example):** ``` Docker is not running. Start Docker: Run: open -a Docker (or launch Docker Desktop from Applications) Then retry: yarn twenty server start Don't have Docker? Install from https://docs.docker.com/get-docker/ ``` The platform-specific line is detected via `process.platform`: - `darwin` → `open -a Docker` + Docker Desktop fallback - `linux` → `sudo systemctl start docker` + Docker Desktop fallback - `win32` → "Launch Docker Desktop from the Start menu" - other → link to install docs The retry command is computed at the call site so it preserves the user's actual flags — `yarn twenty server start --test`, `yarn twenty server upgrade 2.2.0 --test`, etc. ## Why This came out of shadowing a first-time app developer who hit this error during `npx create-twenty-app`. They were stuck — the CLI told them to "try again" but they had only learned two commands so far (`create-twenty-app` and `yarn dev`), neither of which was the right one. Improving the message turns the error into a teaching moment. ## Test plan - [x] `npx nx typecheck twenty-sdk` passes - [x] `npx nx lint twenty-sdk` passes - [x] Manually verified rendered output for both `server start` and `server upgrade` flows on macOS - [ ] Verify message renders correctly on Linux/Windows in practice ## Possible follow-ups (out of scope) - Auto-launch Docker Desktop on macOS if installed (changes user state — separate PR) - Make the multi-line CLI error printer style only the first line in red, so guidance reads as default text rather than red Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f9a2407 commit e50adaf

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

packages/twenty-sdk/src/cli/operations/server-start.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
DEFAULT_PORT,
1010
DEFAULT_TEST_PORT,
1111
getContainerPort,
12+
getDockerNotRunningMessage,
1213
IMAGE,
1314
isContainerRunning,
1415
TEST_CONTAINER_NAME,
@@ -148,11 +149,15 @@ const innerServerStart = async (
148149
}
149150

150151
if (!checkDockerRunning()) {
152+
const retryCommand = isTest
153+
? 'yarn twenty server start --test'
154+
: 'yarn twenty server start';
155+
151156
return {
152157
success: false,
153158
error: {
154159
code: SERVER_ERROR_CODES.DOCKER_NOT_RUNNING,
155-
message: 'Docker is not running. Please start Docker and try again.',
160+
message: getDockerNotRunningMessage(retryCommand),
156161
},
157162
};
158163
}

packages/twenty-sdk/src/cli/operations/server-upgrade.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
containerExists,
77
getContainerDigest,
88
getContainerPort,
9+
getDockerNotRunningMessage,
910
getImageDigest,
1011
getImageForVersion,
1112
TEST_CONTAINER_NAME,
@@ -30,11 +31,19 @@ const innerServerUpgrade = async (
3031
const { version = 'latest', test: isTest, onProgress } = options;
3132

3233
if (!checkDockerRunning()) {
34+
const retryCommand = [
35+
'yarn twenty server upgrade',
36+
version !== 'latest' ? version : null,
37+
isTest ? '--test' : null,
38+
]
39+
.filter(Boolean)
40+
.join(' ');
41+
3342
return {
3443
success: false,
3544
error: {
3645
code: SERVER_ERROR_CODES.DOCKER_NOT_RUNNING,
37-
message: 'Docker is not running. Please start Docker and try again.',
46+
message: getDockerNotRunningMessage(retryCommand),
3847
},
3948
};
4049
}

packages/twenty-sdk/src/cli/utilities/server/docker-container.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,29 @@ export const checkDockerRunning = (): boolean => {
103103
return false;
104104
}
105105
};
106+
107+
const getDockerStartInstruction = (): string => {
108+
switch (process.platform) {
109+
case 'darwin':
110+
return ' Run: open -a Docker\n (or launch Docker Desktop from Applications)';
111+
case 'linux':
112+
return ' Run: sudo systemctl start docker\n (or launch Docker Desktop if installed)';
113+
case 'win32':
114+
return ' Launch Docker Desktop from the Start menu';
115+
default:
116+
return ' See https://docs.docker.com/engine/install/ for installation';
117+
}
118+
};
119+
120+
export const getDockerNotRunningMessage = (retryCommand: string): string =>
121+
[
122+
'Docker is not running.',
123+
'',
124+
'Start Docker:',
125+
getDockerStartInstruction(),
126+
'',
127+
'Then retry:',
128+
` ${retryCommand}`,
129+
'',
130+
"Don't have Docker? Install from https://docs.docker.com/get-docker/",
131+
].join('\n');

0 commit comments

Comments
 (0)