{"record":{"id":"98149407cf064c3d","repo":"serverless/serverless","slug":"nested-custom-configuration-path","errorCode":"NESTED_CUSTOM_CONFIGURATION_PATH","errorMessage":"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","messagePattern":"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","errorType":"exception","errorClass":"ServerlessError","httpStatus":null,"severity":"error","filePath":"packages/serverless/lib/cli/resolve-configuration-path.js","lineNumber":61,"sourceCode":"          throw new ServerlessError(\n            `'Invalid \"--config\" value: Cannot find \"${customConfigName}\" in service folder`,\n            'INVALID_SERVICE_CONFIG_PATH',\n          )\n        }\n        throw new ServerlessError(\n          `Invalid \"--config\" value: \"${customConfigName}\" is not accessible: ${error.stack}`,\n          'INVALID_SERVICE_CONFIG_PATH',\n        )\n      }\n    })()\n    if (!stats.isFile()) {\n      throw new ServerlessError(\n        `Invalid \"--config\" value: \"${customConfigName}\" is not a file`,\n        'INVALID_SERVICE_CONFIG_PATH',\n      )\n    }\n    if (cwd !== path.dirname(customConfigPath)) {\n      throw new ServerlessError(\n        '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',\n        'NESTED_CUSTOM_CONFIGURATION_PATH',\n      )\n    }\n    return customConfigPath\n  }\n\n  for (const extension of supportedExtensions) {\n    const eventualServiceConfigPath = path.resolve(\n      cwd,\n      `serverless.${extension}`,\n    )\n    if (await fileExists(eventualServiceConfigPath))\n      return eventualServiceConfigPath\n  }\n  return null\n}\n","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/serverless/serverless/blob/b9d7ea51c8cce57cff1207964b9b71123673081f/packages/serverless/lib/cli/resolve-configuration-path.js#L43-L79","documentation":"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.\n\" thrown in serverless/serverless.","triggerScenarios":"Thrown at packages/serverless/lib/cli/resolve-configuration-path.js:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the command from the service root directory where serverless.yml lives, since all paths resolve relative to it."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b9d7ea51c8cce57cff1207964b9b71123673081f","analyzedAt":"2026-08-13T04:14:40.386Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}