{"record":{"id":"bbb1ac3fafa7bb5f","repo":"facebook/docusaurus","slug":"you-specified-source-but-file-at-path-path-f-bbb1ac","errorCode":null,"errorMessage":"You specified ${source}, but file at path path=${filepath} can't be read.","messagePattern":"You specified (.+?), but file at path path=(.+?) can't be read\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/webpack/utils/getHttpsConfig.ts","lineNumber":89,"sourceCode":"};\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(\n  options: Partial<HttpsConfigOptions>,\n  cwd: string,\n): Promise<CryptoFile> | null {\n  if (options.sslCert) {\n    return readCryptoFile(\n      path.resolve(cwd, options.sslCert),\n      'CLI arg --ssl-cert',\n    );\n  }\n  if (process.env.DOCUSAURUS_SSL_CRT_FILE) {\n    return readCryptoFile(","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/webpack/utils/getHttpsConfig.ts#L71-L107","documentation":"Thrown by readCryptoFile() when the SSL cert/key file DOES exist (fs.pathExists passed) but fs.readFile() rejects while reading its bytes. The original IO error is attached via `{cause: error}` on the thrown Error so the underlying reason (EACCES, EISDIR, disk read failure) is preserved. The {source} placeholder again tells you which input supplied the path.","triggerScenarios":"The cert/key path resolves to a directory rather than a file; the file exists but the Node process lacks read permission (EACCES); the file is on a mount that became unreadable; a symlink points to a missing/broken target that pathExists followed but read cannot complete.","commonSituations":"Pointing --ssl-cert at a directory by mistake; certs created by root/root and the dev process runs as a non-privileged user without read access; copied a broken symlink into the certs folder; file locked or being written by another process on Windows.","solutions":["Inspect the `cause` on the thrown error — it carries the real errno (EACCES, EISDIR, ENOENT-on-symlink) which tells you the fix.","Confirm the path is a regular file, not a directory: `test -f \"<path>\" && file \"<path>\"`.","Fix permissions so the Node process can read it: `chmod 644 <cert> <key>` (and ensure the user running the CLI owns or can read them).","If it is a symlink, resolve it and point directly at the real file, or recreate the target."],"exampleFix":"// before: --ssl-cert points at a dir / unreadable file\ndocusaurus start --https --ssl-cert ./certs\n// after: point at the readable regular file\nchmod 644 ./certs/server.crt\ndocusaurus start --https --ssl-cert ./certs/server.crt","handlingStrategy":"validation","validationCode":"import fs from 'fs-extra';\nimport path from 'path';\n\nasync function assertCryptoFileReadable(rawPath: string, cwd = process.cwd()) {\n  const abs = path.resolve(cwd, rawPath);\n  const stat = await fs.stat(abs);\n  if (!stat.isFile()) throw new Error(`${abs} is not a regular file`);\n  await fs.access(abs, fs.constants.R_OK); // throws EACCES if unreadable\n  return abs;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await getHttpsConfig({ https: true, sslCert, sslKey });\n} catch (err) {\n  // err.cause carries the real errno (EACCES/EISDIR) from fs.readFile\n  if (err.cause?.code === 'EACCES') {\n    console.error('Fix file permissions on the SSL cert/key.');\n  }\n  throw err;\n}","preventionTips":["Check file permissions in CI setup (chmod 644 cert, 600 key).","Ensure the cert path points at a file, not a directory (fs.stat().isFile()).","Avoid symlinks for certs in CI; copy the real file to avoid broken-target reads."],"tags":["https","ssl","filesystem","permissions","dev-server"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}