Skip to content

Commit ebd27c0

Browse files
Classify config file and out of disk CLI errors as config errors (#2297)
Co-authored-by: Henry Mercer <henrymercer@github.com>
1 parent b46ca8c commit ebd27c0

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

lib/cli-errors.js

+16-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/cli-errors.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli-errors.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,18 @@ function ensureEndsInPeriod(text: string): string {
122122
/** Error messages from the CLI that we consider configuration errors and handle specially. */
123123
export enum CliConfigErrorCategory {
124124
ExternalRepositoryCloneFailed = "ExternalRepositoryCloneFailed",
125-
GracefulOutOfMemory = "GracefulOutOfMemory",
126125
GradleBuildFailed = "GradleBuildFailed",
127126
IncompatibleWithActionVersion = "IncompatibleWithActionVersion",
128127
InitCalledTwice = "InitCalledTwice",
128+
InvalidConfigFile = "InvalidConfigFile",
129129
InvalidSourceRoot = "InvalidSourceRoot",
130130
MavenBuildFailed = "MavenBuildFailed",
131131
NoBuildCommandAutodetected = "NoBuildCommandAutodetected",
132132
NoBuildMethodAutodetected = "NoBuildMethodAutodetected",
133133
NoSourceCodeSeen = "NoSourceCodeSeen",
134134
NoSupportedBuildCommandSucceeded = "NoSupportedBuildCommandSucceeded",
135135
NoSupportedBuildSystemDetected = "NoSupportedBuildSystemDetected",
136+
OutOfMemoryOrDisk = "OutOfMemoryOrDisk",
136137
PackCannotBeFound = "PackCannotBeFound",
137138
SwiftBuildFailed = "SwiftBuildFailed",
138139
UnsupportedBuildMode = "UnsupportedBuildMode",
@@ -158,9 +159,6 @@ export const cliErrorsConfig: Record<
158159
new RegExp("Failed to clone external Git repository"),
159160
],
160161
},
161-
[CliConfigErrorCategory.GracefulOutOfMemory]: {
162-
cliErrorMessageCandidates: [new RegExp("CodeQL is out of memory.")],
163-
},
164162
[CliConfigErrorCategory.GradleBuildFailed]: {
165163
cliErrorMessageCandidates: [
166164
new RegExp("[autobuild] FAILURE: Build failed with an exception."),
@@ -180,6 +178,12 @@ export const cliErrorsConfig: Record<
180178
],
181179
additionalErrorMessageToAppend: `Is the "init" action called twice in the same job?`,
182180
},
181+
[CliConfigErrorCategory.InvalidConfigFile]: {
182+
cliErrorMessageCandidates: [
183+
new RegExp("Config file .* is not valid"),
184+
new RegExp("The supplied config file is empty"),
185+
],
186+
},
183187
// Expected source location for database creation does not exist
184188
[CliConfigErrorCategory.InvalidSourceRoot]: {
185189
cliErrorMessageCandidates: [new RegExp("Invalid source root")],
@@ -214,7 +218,6 @@ export const cliErrorsConfig: Record<
214218
),
215219
],
216220
},
217-
218221
[CliConfigErrorCategory.NoSupportedBuildCommandSucceeded]: {
219222
cliErrorMessageCandidates: [
220223
new RegExp("No supported build command succeeded"),
@@ -225,6 +228,15 @@ export const cliErrorsConfig: Record<
225228
new RegExp("No supported build system detected"),
226229
],
227230
},
231+
[CliConfigErrorCategory.OutOfMemoryOrDisk]: {
232+
cliErrorMessageCandidates: [
233+
new RegExp("CodeQL is out of memory."),
234+
new RegExp("out of disk"),
235+
new RegExp("No space left on device"),
236+
],
237+
additionalErrorMessageToAppend:
238+
"For more information, see https://gh.io/troubleshooting-code-scanning/out-of-disk-or-memory",
239+
},
228240
[CliConfigErrorCategory.PackCannotBeFound]: {
229241
cliErrorMessageCandidates: [
230242
new RegExp(

0 commit comments

Comments
 (0)