Skip to content

Commit 54b73d2

Browse files
committed
Improve OOM error messages
1 parent 457649b commit 54b73d2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/cli-v3/src/workers/common/errors.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ export class GracefulExitTimeoutError extends Error {
6969
export function getFriendlyErrorMessage(
7070
code: number,
7171
signal: NodeJS.Signals | null,
72-
stderr: string | undefined
72+
stderr: string | undefined,
73+
dockerMode = true
7374
) {
7475
const message = (text: string) => {
7576
if (signal) {
@@ -79,7 +80,20 @@ export function getFriendlyErrorMessage(
7980
}
8081
};
8182

82-
if (code === 137 || stderr?.includes("OOMErrorHandler")) {
83+
if (code === 137) {
84+
if (dockerMode) {
85+
return message(
86+
"Process ran out of memory! Try choosing a machine preset with more memory for this task."
87+
);
88+
} else {
89+
// Note: containerState reason and message should be checked to clarify the error
90+
return message(
91+
"Process most likely ran out of memory, but we can't be certain. Try choosing a machine preset with more memory for this task."
92+
);
93+
}
94+
}
95+
96+
if (stderr?.includes("OOMErrorHandler")) {
8397
return message(
8498
"Process ran out of memory! Try choosing a machine preset with more memory for this task."
8599
);

0 commit comments

Comments
 (0)