serverless/serverless · error · ServerlessError

INVALID_SERVICE_CONFIG_PATH

INVALID_SERVICE_CONFIG_PATH

Error message

Invalid "--config" value: Unsupported file extension (expected one of: ${Array.from(supportedExtensions).join(', ')}

What it means

Error "Invalid "--config" value: Unsupported file extension (expected one of: ${Array.from(supportedExtensions).join(', ')}" thrown in serverless/serverless.

Source

Thrown at packages/serverless/lib/cli/resolve-configuration-path.js:32

  'mjs',
  'cjs',
  'ts',
])

export default async (options = {}) => {
  if (!options) options = {}
  const cliOptions =
    ensurePlainObject(options.options, { isOptional: true }) ||
    resolveInput().options
  const cwd = path.resolve(
    ensureString(options.cwd, { isOptional: true }) || process.cwd(),
  )
  const customConfigName = cliOptions.config

  if (customConfigName) {
    const customConfigPath = path.resolve(cwd, customConfigName)
    if (!supportedExtensions.has(path.extname(customConfigPath).slice(1))) {
      throw new ServerlessError(
        'Invalid "--config" value: Unsupported file extension ' +
          `(expected one of: ${Array.from(supportedExtensions).join(', ')}`,
        'INVALID_SERVICE_CONFIG_PATH',
      )
    }
    const stats = await (async () => {
      try {
        return await fsp.stat(customConfigPath)
      } catch (error) {
        if (error.code === 'ENOENT') {
          throw new ServerlessError(
            `'Invalid "--config" value: Cannot find "${customConfigName}" in service folder`,
            'INVALID_SERVICE_CONFIG_PATH',
          )
        }
        throw new ServerlessError(
          `Invalid "--config" value: "${customConfigName}" is not accessible: ${error.stack}`,
          'INVALID_SERVICE_CONFIG_PATH',

View on GitHub (pinned to b9d7ea51c8)

Solutions

  1. Point --config at a file with a supported extension such as .yml, .yaml, .json, .js, or .ts.

When it happens

Trigger: Thrown at packages/serverless/lib/cli/resolve-configuration-path.js:32 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of serverless/serverless@b9d7ea51c8 (2026-08-13). Data as JSON: /api/errors/7e8bf4464d0f5cf4. Report an issue: GitHub.