diff --git a/lib/entry-points.js b/lib/entry-points.js index d450071b5..7f095b9ca 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -154094,7 +154094,13 @@ async function getCodeQLForCmd(cmd, checkVersion) { }, async resolveExtractor(language) { const output = await this.resolveLanguages(); - return output.extractors[language][0].extractor_root; + const extractors = output.extractors[language]; + if (extractors === void 0) { + throw new Error( + `Unable to resolve an extractor for the language '${language}'.` + ); + } + return extractors[0].extractor_root; }, async resolveQueriesStartingPacks(queries) { const codeqlArgs = [ diff --git a/src/codeql.ts b/src/codeql.ts index dbc659b7a..36bd4e598 100644 --- a/src/codeql.ts +++ b/src/codeql.ts @@ -994,7 +994,13 @@ async function getCodeQLForCmd( // This can be a bit slow due to the JVM startup cost. Instead, get // the extractor path from resolveLanguages(), which caches its output. const output = await this.resolveLanguages(); - return output.extractors[language][0].extractor_root; + const extractors = output.extractors[language]; + if (extractors === undefined) { + throw new Error( + `Unable to resolve an extractor for the language '${language}'.`, + ); + } + return extractors[0].extractor_root; }, async resolveQueriesStartingPacks(queries: string[]): Promise { const codeqlArgs = [