vercel/next.js · error · Error
Certificate files not found
Error message
Certificate files not found
What it means
Post-run verification in createSelfSignedCertificate: mkcert was executed with -install and exited without error, but the expected key and/or certificate files were still not written to disk. The tool's exit status lied about success, so Next.js re-checks the filesystem before trusting the result.
Source
Thrown at packages/next/src/lib/mkcert.ts:155
const defaultHosts = ['localhost', '127.0.0.1', '::1']
const hosts =
host && !defaultHosts.includes(host)
? [...defaultHosts, host]
: defaultHosts
execSync(
`"${binaryPath}" -install -key-file "${keyPath}" -cert-file "${certPath}" ${hosts.join(
' '
)}`,
{ stdio: 'ignore' }
)
const caLocation = execSync(`"${binaryPath}" -CAROOT`).toString().trim()
if (!fs.existsSync(keyPath) || !fs.existsSync(certPath)) {
throw new Error('Certificate files not found')
}
Log.info(`CA Root certificate created in ${caLocation}`)
Log.info(`Certificates created in ${resolvedCertDir}`)
const gitignorePath = path.resolve(process.cwd(), './.gitignore')
if (fs.existsSync(gitignorePath)) {
const gitignore = await fs.promises.readFile(gitignorePath, 'utf8')
if (!gitignore.includes(certDir)) {
Log.info('Adding certificates to .gitignore')
await fs.promises.appendFile(gitignorePath, `\n${certDir}`)
}
}
return {
key: keyPath,View on GitHub (pinned to 0eb3775416)
Solutions
- Re-run the certificate generation (next dev --experimental-https) so the cert files are created.
Defensive patterns
Strategy: validation
When it happens
Trigger: mkcert ran but the generated certificate files are not found.
Common situations: Certificate generation failed silently or files were written to an unexpected location.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19).
Data as JSON: /api/errors/4af82f111ab5cb9c.
Report an issue: GitHub.