{"record":{"id":"91224e8b00bdec37","repo":"facebook/docusaurus","slug":"you-specified-source-but-file-at-path-path-f","errorCode":null,"errorMessage":"You specified ${source}, but file at path path=${filepath} can't be found.","messagePattern":"You specified (.+?), but file at path path=(.+?) can't be found\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/webpack/utils/getHttpsConfig.ts","lineNumber":78,"sourceCode":"      : undefined) ??\n    (typeof process.env.HTTPS !== 'undefined'\n      ? process.env.HTTPS == 'true'\n      : undefined)\n  );\n}\n\ntype CryptoFile = {\n  path: string;\n  content: Buffer;\n  source: string;\n};\n\nasync function readCryptoFile(\n  filepath: string,\n  source: string,\n): Promise<CryptoFile> {\n  if (!(await fs.pathExists(filepath))) {\n    throw new Error(\n      logger.interpolate`You specified ${source}, but file at path path=${filepath} can't be found.`,\n    );\n  }\n  try {\n    return {\n      path: filepath,\n      source,\n      content: await fs.readFile(filepath),\n    };\n  } catch (error) {\n    throw new Error(\n      logger.interpolate`You specified ${source}, but file at path path=${filepath} can't be read.`,\n      {cause: error},\n    );\n  }\n}\n\nfunction getCert(","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/webpack/utils/getHttpsConfig.ts#L60-L96","documentation":"Thrown by readCryptoFile() in the HTTPS dev-server config when Docusaurus resolves an SSL cert/key file path (from --ssl-cert/--ssl-key CLI args, or DOCUSAURUS_SSL_CRT_FILE/DOCUSAURUS_SSL_KEY_FILE/SSL_CRT_FILE/SSL_KEY_FILE env vars) but fs.pathExists reports the file does not exist. The {source} placeholder names exactly which input supplied the path so you know which knob to fix. The path is resolved relative to process.cwd() (via fs.realpath), so relative paths are interpreted from the directory you ran the CLI in.","triggerScenarios":"Running `docusaurus start --https --ssl-cert ./cert.pem --ssl-key ./key.pem` (or setting DOCUSAURUS_SSL_CRT_FILE / SSL_CRT_FILE / DOCUSAURUS_SSL_KEY_FILE / SSL_KEY_FILE) where the referenced file does not exist on disk. Also triggered when the path has a typo, points to an absolute location that is only valid in another environment, or when cwd differs from where the certs actually live.","commonSituations":"Following an HTTPS tutorial that assumes certs live in the project root, but they were generated elsewhere; checking the repo out on a new machine where mkcert certs were never created; using a relative path while running the CLI from a different working directory than expected; trailing whitespace or quote mistakes in the env var value.","solutions":["Verify the file exists at the resolved absolute path: `ls -la \"$(pwd)/<your-cert-path>\"` and compare it to the path in the error message.","If using a relative path, remember it is resolved from process.cwd() — run the CLI from the directory the path is relative to, or switch to an absolute path.","Generate a local cert/key pair first, e.g. `mkcert localhost` then point --ssl-cert ./localhost.pem --ssl-key ./localhost-key.pem.","Check the {source} label in the message to confirm whether the path came from a CLI flag or an env var, and fix that specific input (unset the stale env var if you meant to use the CLI flag)."],"exampleFix":"// before\nDOCUSAURUS_SSL_CRT_FILE=certs/server.crt docusaurus start --https\n// after (path resolved from cwd; use absolute if unsure)\nDOCUSAURUS_SSL_CRT_FILE=/abs/path/to/certs/server.crt docusaurus start --https","handlingStrategy":"validation","validationCode":"import fs from 'fs-extra';\nimport path from 'path';\n\nasync function assertCryptoFileExists(rawPath: string, cwd = process.cwd()) {\n  const abs = path.resolve(cwd, rawPath);\n  if (!(await fs.pathExists(abs))) {\n    throw new Error(`SSL file not found (resolved to ${abs}). Generate one with: mkcert localhost`);\n  }\n  return abs;\n}\n\n// before starting: await assertCryptoFileExists(process.env.DOCUSAURUS_SSL_CRT_FILE);","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Always pass SSL cert/key paths as absolute paths to avoid cwd-dependent resolution.","Keep cert/key generation in the project setup script (mkcert) so every contributor has them.","Document the required env vars (DOCUSAURUS_SSL_CRT_FILE / DOCUSAURUS_SSL_KEY_FILE) in the repo README."],"tags":["https","ssl","dev-server","config","filesystem"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}