{"record":{"id":"6eaaeb236622844b","repo":"abpframework/abp","slug":"there-are-more-than-1-config-abp-build-config-jso","errorCode":null,"errorMessage":"There are more than 1 config (abp-build-config.json) file in the directory!","messagePattern":"There are more than 1 config \\(abp-build-config\\.json\\) file in the directory!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Build/FileSystemDotNetProjectBuildConfigReader.cs","lineNumber":59,"sourceCode":"\n            return buildConfig;\n        }\n\n        var configFiles = Directory.GetFiles(directoryPath, _buildConfigName, SearchOption.TopDirectoryOnly);\n        if (configFiles.Length == 1)\n        {\n            var configFile = configFiles.First();\n            var configFileContent = File.ReadAllText(configFile);\n            buildConfig.GitRepository = _jsonSerializer.Deserialize<GitRepository>(configFileContent);\n\n            SetBranchNames(buildConfig.GitRepository);\n\n            return buildConfig;\n        }\n\n        if (configFiles.Length > 1)\n        {\n            throw new Exception(\n                \"There are more than 1 config (abp-build-config.json) file in the directory!\"\n            );\n        }\n\n        return new DotNetProjectBuildConfig\n        {\n            GitRepository = GetGitRepositoryUsingDirectory(directoryPath)\n        };\n    }\n\n    private GitRepository GetGitRepositoryUsingDirectory(string directoryPath)\n    {\n        var directoryInfo = new DirectoryInfo(directoryPath);\n\n        do\n        {\n            var gitFolderPath = string.Concat(directoryInfo.FullName, @\"\\.git\");\n            if (Directory.Exists(gitFolderPath))","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Build/FileSystemDotNetProjectBuildConfigReader.cs#L41-L77","documentation":"Thrown by FileSystemDotNetProjectBuildConfigReader.Read when Directory.GetFiles finds more than one 'abp-build-config.json' in the working directory (TopDirectoryOnly). The reader can only consume a single build-config file per directory; ambiguity is treated as an error rather than guessing.","triggerScenarios":"Read(directoryPath) runs, the .sln/.slnx count is not exactly one, and configFiles (abp-build-config.json) length is > 1. Common when config files were duplicated by a copy, merge, or template operation.","commonSituations":"A previous build artifact copied the config into a subfolder that is now the working directory; a solution-to-folder restructure left two configs; merging branches duplicated the file; a sample/template generated an extra config alongside an existing one.","solutions":["List abp-build-config.json files in the directory and keep exactly one (delete or relocate the duplicate).","If the configs differ intentionally, merge them into a single abp-build-config.json with the correct GitRepository definition.","Point the ABP build command at a directory that contains exactly one config file.","Add the stray config to source-control ignore if it is a generated artifact."],"exampleFix":"# before: two config files present\nfind . -maxdepth 1 -name 'abp-build-config.json'\n# ./abp-build-config.json\n# ./abp-build-config.json.bak  (or a second copy)\n# after: remove the duplicate\nrm ./abp-build-config.json.bak\nabp build","handlingStrategy":"validation","validationCode":"// Ensure exactly one abp-build-config.json in the directory.\nvar configs = Directory.GetFiles(directoryPath, \"abp-build-config.json\", SearchOption.TopDirectoryOnly);\nif (configs.Length > 1)\n{\n    throw new InvalidOperationException($\"Found {configs.Length} abp-build-config.json files; keep exactly one. Files: {string.Join(\", \", configs)}\");\n}","typeGuard":"public static bool HasSingleBuildConfig(string directoryPath) =>\n    Directory.GetFiles(directoryPath, \"abp-build-config.json\", SearchOption.TopDirectoryOnly).Length == 1;","tryCatchPattern":"try\n{\n    var cfg = reader.Read(directoryPath);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"more than 1 config\", StringComparison.Ordinal))\n{\n    logger.LogError(ex, \"Multiple abp-build-config.json files; remove the duplicate.\");\n    throw;\n}","preventionTips":["Keep a single abp-build-config.json per build directory.","Add generated/backup configs to .gitignore to prevent accidental duplicates.","Review directory contents before running 'abp build' after a branch merge.","Merge differing configs instead of leaving side-by-side copies."],"tags":["cli","build","configuration","file-system"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}