serverless/serverless · error · ServerlessError

NESTED_CUSTOM_CONFIGURATION_PATH

NESTED_CUSTOM_CONFIGURATION_PATH

Error message

Service configuration is expected to be placed in a root of a service (working directory). All paths, function handlers in a configuration are resolved against service directory.

What it means

Error "Service configuration is expected to be placed in a root of a service (working directory). All paths, function handlers in a configuration are resolved against service directory. " thrown in serverless/serverless.

Source

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

          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',
        )
      }
    })()
    if (!stats.isFile()) {
      throw new ServerlessError(
        `Invalid "--config" value: "${customConfigName}" is not a file`,
        'INVALID_SERVICE_CONFIG_PATH',
      )
    }
    if (cwd !== path.dirname(customConfigPath)) {
      throw new ServerlessError(
        'Service configuration is expected to be placed in a root of a service (working directory). All paths, function handlers in a configuration are resolved against service directory.\n',
        'NESTED_CUSTOM_CONFIGURATION_PATH',
      )
    }
    return customConfigPath
  }

  for (const extension of supportedExtensions) {
    const eventualServiceConfigPath = path.resolve(
      cwd,
      `serverless.${extension}`,
    )
    if (await fileExists(eventualServiceConfigPath))
      return eventualServiceConfigPath
  }
  return null
}

View on GitHub (pinned to b9d7ea51c8)

Solutions

  1. Run the command from the service root directory where serverless.yml lives, since all paths resolve relative to it.

When it happens

Trigger: Thrown at packages/serverless/lib/cli/resolve-configuration-path.js:61 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/98149407cf064c3d. Report an issue: GitHub.