{"record":{"id":"fdace320369cea13","repo":"apache/cordova-android","slug":"specified-build-config-file-does-not-exist-buil","errorCode":null,"errorMessage":"Specified build config file does not exist: ${buildConfig}","messagePattern":"Specified build config file does not exist: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/build.js","lineNumber":84,"sourceCode":"        const gradleArgs = parseArgsStringToArgv(options.argv.gradleArg[0]);\n        ret.extraArgs = ret.extraArgs.concat(gradleArgs);\n    }\n\n    const packageArgs = {};\n\n    if (options.argv.keystore) { packageArgs.keystore = path.relative(projectRoot, path.resolve(options.argv.keystore)); }\n\n    ['alias', 'storePassword', 'password', 'keystoreType', 'packageType'].forEach(function (flagName) {\n        if (options.argv[flagName]) { packageArgs[flagName] = options.argv[flagName]; }\n    });\n\n    const buildConfig = options.buildConfig;\n\n    // If some values are not specified as command line arguments - use build config to supplement them.\n    // Command line arguments have precedence over build config.\n    if (buildConfig) {\n        if (!fs.existsSync(buildConfig)) {\n            throw new Error('Specified build config file does not exist: ' + buildConfig);\n        }\n        events.emit('log', 'Reading build config file: ' + path.resolve(buildConfig));\n        const buildjson = fs.readFileSync(buildConfig, 'utf8');\n        const config = JSON.parse(buildjson.replace(/^\\ufeff/, '')); // Remove BOM\n        if (config.android && config.android[ret.buildType]) {\n            const androidInfo = config.android[ret.buildType];\n            if (androidInfo.keystore && !packageArgs.keystore) {\n                androidInfo.keystore = untildify(androidInfo.keystore);\n                packageArgs.keystore = path.resolve(path.dirname(buildConfig), androidInfo.keystore);\n                events.emit('log', 'Reading the keystore from: ' + packageArgs.keystore);\n            }\n\n            ['alias', 'storePassword', 'password', 'keystoreType', 'packageType'].forEach(function (key) {\n                packageArgs[key] = packageArgs[key] || androidInfo[key];\n            });\n        }\n    }\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/cordova-android/blob/7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3/lib/build.js#L66-L102","documentation":"build.js reads options.buildConfig (from the --buildConfig CLI flag or the programmatic options object) to supplement signing parameters, and first requires the file to exist on disk. Thrown by fs.existsSync failing before any JSON is parsed - the path itself resolves to nothing.","triggerScenarios":"`cordova build/run/emulate android --buildConfig=<path>` (or Api.build({ buildConfig: '<path>' })) where <path> does not exist - wrong filename, wrong directory, or a relative path resolved against an unexpected cwd.","commonSituations":"Running the CLI from a different working directory with a relative --buildConfig path; typo'd filename; build.json not committed/present in CI; file moved after docs were written.","solutions":["Verify the path: `ls <path>`; if relative, re-run from the project root or pass an absolute path.","If the file is missing, create a build.json with the android.debug/android.release keystore blocks.","In CI, make sure the step that produces/copies build.json runs before cordova build."],"exampleFix":"# before (run from platforms/android - relative path now points nowhere)\ncordova build android --buildConfig=build.json\n\n# after (absolute path from the project root)\ncordova build android --buildConfig=\"$(pwd)/build.json\"","handlingStrategy":"validation","validationCode":"const buildConfigPath = path.resolve(options.buildConfig);\nif (!fs.existsSync(buildConfigPath)) {\n  throw new Error(`buildConfig not found: ${buildConfigPath} - create it or fix the path`);\n}\n// safe to pass on\nawait androidApi.build({ ...options, buildConfig: buildConfigPath });","typeGuard":null,"tryCatchPattern":"try {\n  await androidApi.build(opts);\n} catch (e) {\n  if (/build config file does not exist/.test(e.message)) {\n    throw new Error(`Missing ${opts.buildConfig} - run from the project root or pass an absolute path`);\n  }\n  throw e;\n}","preventionTips":["Store build.json at the project root and pass an absolute path (path.resolve) from scripts.","Commit build.json (or generate it in CI from secrets) before the build step runs.","Fail fast in npm scripts: `[ -f build.json ] || exit 1` before cordova build."],"tags":["build-config","signing","file-not-found","cli-args"],"backgroundTag":"config-file-not-found","analyzedSha":"7c1e190064e349ffa4bbc6ac37b77cd773e4dbd3","analyzedAt":"2026-08-22T04:57:58.868Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}